Commit 4490c825e160b9b8f7bdfc0c42fd1b5dd334b742
1 parent
47b0e20e
更新test_fieldConfig和test_upStream的一些demo
Showing
3 changed files
with
26 additions
and
5 deletions
report/test.log
1 | +[2021-07-27 11:24:15] [INFO] : ====================================================================================== | |
2 | +[2021-07-27 11:24:15] [INFO] : http://test.trace.diligrp.com:8393/upStream/listPage.action | |
3 | +None | |
4 | +{'rows': 10, 'page': 1, 'sort': 'id', 'order': 'desc', 'metadata': {'created': '{"provider":"datetimeProvider","index":10,"field":"created"}', 'upORdown': '{"provider":"userFlagProvider","index":20,"field":"upORdown"}', 'upstreamType': '{"provider":"upStreamTypeProvider","index":30,"field":"upstreamType"}'}} | |
5 | +{'headers': {'Host': 'test.trace.diligrp.com', 'Connection': 'keep-alive', 'Content-Length': '325', 'Accept': 'application/json,text/javascript,*/*;q=0.01', 'X-Requested-With': 'XMLHttpRequest', 'User-Agent': 'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/90.0.4430.212Safari/537.36', 'Content-Type': 'application/json', 'Origin': 'http://test.trace.diligrp.com:8393', 'Referer': 'http://test.trace.diligrp.com:8393/upStream/index.html', 'Accept-Encoding': 'gzip,deflate', 'Accept-Language': 'zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7'}} | |
6 | +[2021-07-27 11:24:16] [INFO] : ====================================================================================== | |
7 | +[2021-07-27 11:24:16] [INFO] : http://test.trace.diligrp.com:8393/upStream/listPage.action | |
8 | +None | |
9 | +{'rows': 10, 'page': 1, 'sort': 'id', 'order': 'desc', 'metadata': {'created': '{"provider":"datetimeProvider","index":10,"field":"created"}', 'upORdown': '{"provider":"userFlagProvider","index":20,"field":"upORdown"}', 'upstreamType': '{"provider":"upStreamTypeProvider","index":30,"field":"upstreamType"}'}, 'likeName': '111'} | |
10 | +{'headers': {'Host': 'test.trace.diligrp.com', 'Connection': 'keep-alive', 'Content-Length': '325', 'Accept': 'application/json,text/javascript,*/*;q=0.01', 'X-Requested-With': 'XMLHttpRequest', 'User-Agent': 'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/90.0.4430.212Safari/537.36', 'Content-Type': 'application/json', 'Origin': 'http://test.trace.diligrp.com:8393', 'Referer': 'http://test.trace.diligrp.com:8393/upStream/index.html', 'Accept-Encoding': 'gzip,deflate', 'Accept-Language': 'zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7'}} | ... | ... |
testcase/fieldConfig/test_fieldConfig.py
... | ... | @@ -4,6 +4,8 @@ import unittest |
4 | 4 | from commons import common as com |
5 | 5 | from commons.MySession import my |
6 | 6 | |
7 | + | |
8 | + | |
7 | 9 | class test_fieldConfig(unittest.TestCase): |
8 | 10 | "Unittest用例结构的简单的认识" |
9 | 11 | @classmethod |
... | ... | @@ -15,7 +17,7 @@ class test_fieldConfig(unittest.TestCase): |
15 | 17 | #初始化工作:每个用例执行前都会执行一次,N个用例就执行N次,非必要代码 |
16 | 18 | print("setUp") |
17 | 19 | |
18 | - @unittest.case_mark(my.mark()) | |
20 | + @unittest.case_mark(my.mark("test")) | |
19 | 21 | def test_fieldConfig_01(self): |
20 | 22 | "demo" |
21 | 23 | print("test_01_fieldConfig") |
... | ... | @@ -50,14 +52,14 @@ class test_fieldConfig(unittest.TestCase): |
50 | 52 | |
51 | 53 | if __name__ == "__main__": |
52 | 54 | #上述函数为引导执行代码,当模块被直接运行时,以下代码块将被运行,当模块是被导入时,代码块不被运行 |
53 | -# unittest.main(verbosity=2) | |
55 | + unittest.main(verbosity=2) | |
54 | 56 | #unittest.main()为运行的入口/初始化函数,方法会搜索该模块文件下所有以test开头的测试用例方法,并自动执行它们。 |
55 | 57 | # verbosity是一个选项,表示测试结果的信息复杂度,有0、1、2 三个值 |
56 | 58 | # 0 (静默模式): 你只能获得总的测试用例数和总的结果 比如 总共10个 失败2 成功8 |
57 | 59 | # 1 (默认模式): 非常类似静默模式 只是在每个成功的用例前面有个“.” 每个失败的用例前面有个 “F” |
58 | 60 | # 2 (详细模式):测试结果会显示每个测试用例的所有相关的信息 |
59 | 61 | |
60 | - com.run_one(test_fieldConfig("test_fieldConfig_03")) | |
62 | + # com.run_one(test_fieldConfig("test_fieldConfig_03")) | |
61 | 63 | # com.run_list([test_fieldConfig("test_01_fieldConfig"),test_fieldConfig("test_02_fieldConfig")]) |
62 | 64 | # com.run_class(test_fieldConfig) |
63 | 65 | ... | ... |
testcase/upStream/test_upStream.py
... | ... | @@ -10,10 +10,18 @@ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
10 | 10 | uu=upStream() |
11 | 11 | |
12 | 12 | |
13 | +@unittest.case_mark(my.mark()) | |
14 | +class test_upStream01(unittest.TestCase): | |
15 | + | |
16 | + def test_demo(self): | |
17 | + print("test_demo") | |
18 | + | |
19 | + | |
20 | +@unittest.case_mark(my.mark()) | |
13 | 21 | class test_upStream(unittest.TestCase): |
14 | 22 | "上游企业列表查询接口" |
15 | 23 | |
16 | - @unittest.case_mark(my.mark()) | |
24 | + # @unittest.case_mark(my.mark()) | |
17 | 25 | def test_upStream_01(self): |
18 | 26 | "成功查询上下游企业,无过滤条件" |
19 | 27 | #请求数据不需要修改,直接POST请求 |
... | ... | @@ -26,7 +34,7 @@ class test_upStream(unittest.TestCase): |
26 | 34 | |
27 | 35 | |
28 | 36 | @unittest.skipDepend(depend="test_upStream_01") |
29 | - @unittest.case_mark(my.mark(1)) | |
37 | + # @unittest.case_mark(my.mark(1)) | |
30 | 38 | def test_upStream_02(self): |
31 | 39 | "成功查询上下游企业,加入企业/个人名称过滤条件" |
32 | 40 | #请求数据需要修改 |
... | ... | @@ -43,6 +51,7 @@ class test_upStream(unittest.TestCase): |
43 | 51 | def tearDownClass(cls): |
44 | 52 | pass |
45 | 53 | |
54 | + | |
46 | 55 | if __name__ == "__main__": |
47 | 56 | unittest.main(verbosity=2) |
48 | 57 | ... | ... |