Commit a9725e189f7128d417a02dae0aff4a9b7af2b0df
1 parent
598c12f3
报告加入市场判断
Showing
2 changed files
with
7 additions
and
2 deletions
commons/MySession.py
... | ... | @@ -54,6 +54,7 @@ class mysession(requests.Session): |
54 | 54 | self.myproxies={'http': 'http://localhost:8888', 'https': 'http://localhost:8888'} |
55 | 55 | self.allow_redirects = False |
56 | 56 | self.firmid={"group":"1","hd":"2","cd":"3","qqhe":"4","mdj":"5","gy":"6","cc":"7","sg":"8","sy":"9"} |
57 | + self.market={"sy":"沈阳","heb":"哈尔滨","sg":"寿光","gy":"贵阳","cc":"长春","hs":"杭水","hg":"杭果"} | |
57 | 58 | self.user={} |
58 | 59 | |
59 | 60 | def cliLogin(self,user="sy_userName_01"): | ... | ... |
main.py
... | ... | @@ -12,6 +12,8 @@ from commons import common as com |
12 | 12 | from commons.MySession import my |
13 | 13 | from commons.scripts import delReport |
14 | 14 | |
15 | + | |
16 | + | |
15 | 17 | def Create_Testcase_suite(path=""): |
16 | 18 | '''创建测试套件''' |
17 | 19 | if path!="": |
... | ... | @@ -27,8 +29,10 @@ def Create_Testcase_suite(path=""): |
27 | 29 | return testunit |
28 | 30 | |
29 | 31 | |
30 | -def Run_Testcase(testsuit): | |
32 | +def Run_Testcase(testsuit,head=""): | |
31 | 33 | '''运行测试用例并生成报告''' |
34 | + if (head in my.market.keys()): | |
35 | + head="["+ my.market[head] + "]" | |
32 | 36 | now = time.strftime("%Y-%m-%d %H_%M_%S",time.localtime()) |
33 | 37 | path=os.path.dirname(os.path.abspath(sys.argv[0])) |
34 | 38 | report_file=path+"/report/"+now+"_result.html" |
... | ... | @@ -37,7 +41,7 @@ def Run_Testcase(testsuit): |
37 | 41 | |
38 | 42 | runner=HTMLTestRunner_cn.HTMLTestRunner( |
39 | 43 | stream=fp, |
40 | - title=u'进门收费系统--接口测试报告', | |
44 | + title=u'进门收费{}--接口测试报告'.format(head), | |
41 | 45 | description=u'用例简要执行情况如下:(注:报告详细信息需要下载report.html并用浏览器打开)', |
42 | 46 | verbosity = 2) |
43 | 47 | #执行用例 | ... | ... |