这个测试用例听说泡面比较好吃,所以放弃执行了!!+ + +
| 执行 sql 成功--> {'select_one': [{'e_name': 'Ben', 'e_salary': 5000, 'e_dep': 'b2'}]} +pm----------------> {'Url': '/api/register', 'Headers': '{"Content-Type": "application/json"}', 'Query Str': None, 'Request Data Type': 'json', 'Request Data': '{"email": "{{email}}", "password": "{{password}}"}', 'Response': '', 'Assertion': '', 'Error Log': '', None: None} +| 第1次发送请求的参数: {'json': '{"email": "eve.holt@reqres.in", "password": "pistol"}', 'headers': '{"Content-Type": "application/json"}', 'params': None} +| 请求地址 --> https://reqres.in/api/register +| 请求头 --> {'Content-Type': 'application/json', 'Content-Length': '53'} +| 请求 body --> b'{"email": "eve.holt@reqres.in", "password": "pistol"}' +| 接口状态--> 200 +| 接口耗时--> 0:00:43.021884 +| 接口响应--> {"id":4,"token":"QpwL5tke4Pnpja7X4"} +| 断言结果-->[{'检查项': '200', '期望值': '200', '实际值': '200', '断言方法': 'eq:实际值与期望值相等', '断言结果': '通过'}] + +test_api_002_注册 (test_executor.TestProjectApi)执行——>【通过】 ++ + +
| 第1次发送请求的参数: {'json': '{"email": "eve.holt@reqres.in", "password": "pistol"}', 'headers': '{"Content-Type": "application/json"}', 'params': None} +| 请求地址 --> https://reqres.in/api/login +| 请求头 --> {'Content-Type': 'application/json', 'Content-Length': '53'} +| 请求 body --> b'{"email": "eve.holt@reqres.in", "password": "pistol"}' +| 接口状态--> 200 +| 接口耗时--> 0:00:00.528297 +| 接口响应--> {"token":"QpwL5tke4Pnpja7X4"} +请求地址 --> https://reqres.in/api/login +请求头 --> {'Content-Type': 'application/json', 'Content-Length': '53'} +请求 body --> b'{"email": "eve.holt@reqres.in", "password": "pistol"}' +接口状态--> 200 +接口耗时--> 0:00:00.528297 +接口响应--> {"token":"QpwL5tke4Pnpja7X4"} +| 断言结果-->[{'检查项': '200', '期望值': '200', '实际值': '200', '断言方法': 'eq:实际值与期望值相等', '断言结果': '通过'}] + +test_api_003_登录 (test_executor.TestProjectApi)执行——>【通过】 ++ + +
| 第1次发送请求的参数: {'params': None, 'headers': '{"Content-Type":"application/json;charset=utf-8","token":"QpwL5tke4Pnpja7X4"}'} +| 请求地址 --> https://reqres.in/api/users +| 请求头 --> {'Content-Type': 'application/json;charset=utf-8', 'token': 'QpwL5tke4Pnpja7X4'} +| 请求 body --> None +| 接口状态--> 200 +| 接口耗时--> 0:00:00.226330 +| 接口响应--> {"page":1,"per_page":6,"total":12,"total_pages":2,"data":[{"id":1,"email":"george.bluth@reqres.in","first_name":"George","last_name":"Bluth","avatar":"https://reqres.in/img/faces/1-image.jpg"},{"id":2,"email":"janet.weaver@reqres.in","first_name":"Janet","last_name":"Weaver","avatar":"https://reqres.in/img/faces/2-image.jpg"},{"id":3,"email":"emma.wong@reqres.in","first_name":"Emma","last_name":"Wong","avatar":"https://reqres.in/img/faces/3-image.jpg"},{"id":4,"email":"eve.holt@reqres.in","first_name":"Eve","last_name":"Holt","avatar":"https://reqres.in/img/faces/4-image.jpg"},{"id":5,"email":"charles.morris@reqres.in","first_name":"Charles","last_name":"Morris","avatar":"https://reqres.in/img/faces/5-image.jpg"},{"id":6,"email":"tracey.ramos@reqres.in","first_name":"Tracey","last_name":"Ramos","avatar":"https://reqres.in/img/faces/6-image.jpg"}],"support":{"url":"https://reqres.in/#support-heading","text":"To keep ReqRes free, contributions towards server costs are appreciated!"}} +| 断言结果-->[{'检查项': '200', '期望值': 200, '实际值': '200', '断言方法': 'eq:实际值与期望值相等', '断言结果': '失败'}] + +test_api_004_用户列表 (test_executor.TestProjectApi)执行——>【失败】 ++ +
Traceback (most recent call last):-
File "d:\python3.9\lib\unittest\case.py", line 59, in testPartExecutor +File "D:\Program Files\python39\lib\unittest\case.py", line 59, in testPartExecutor yield-File "d:\python3.9\lib\unittest\case.py", line 593, in run +File "D:\Program Files\python39\lib\unittest\case.py", line 593, in run self._callTestMethod(testMethod)-File "d:\python3.9\lib\unittest\case.py", line 550, in _callTestMethod +File "D:\Program Files\python39\lib\unittest\case.py", line 550, in _callTestMethod method()-File "d:\python3.9\lib\unittest\loader.py", line 34, in testFailure - raise self._exception +File "D:\app\apitest\unittestreportnew\core\dataDriver.py", line 43, in wrapper + return func(self, params, *args, **kwargs)-ImportError: Failed to import test module: test_api -Traceback (most recent call last): - File "d:\python3.9\lib\unittest\loader.py", line 436, in _find_test_path - module = self._get_module_from_name(name) - File "d:\python3.9\lib\unittest\loader.py", line 377, in _get_module_from_name - __import__(name) - File "E:\apitest\test_script\test_api.py", line 15, in- excel = DoExcel(test_file) - File "E:\apitest\common\utils\decorators.py", line 25, in get_instance - instance[cls] = cls(*args, **kwargs) - File "E:\apitest\common\file_handling\do_excel.py", line 21, in __init__ - self.wb = load_workbook(self.file_name) - File "C:\Users\Administrator\.virtualenvs\apitest-5XMQbNnO\lib\site-packages\openpyxl\reader\excel.py", line 344, in load_workbook - reader = ExcelReader(filename, read_only, keep_vba, - File "C:\Users\Administrator\.virtualenvs\apitest-5XMQbNnO\lib\site-packages\openpyxl\reader\excel.py", line 123, in __init__ - self.archive = _validate_archive(fn) - File "C:\Users\Administrator\.virtualenvs\apitest-5XMQbNnO\lib\site-packages\openpyxl\reader\excel.py", line 95, in _validate_archive - archive = ZipFile(filename, 'r') - File "d:\python3.9\lib\zipfile.py", line 1239, in __init__ - self.fp = io.open(file, filemode) -FileNotFoundError: [Errno 2] No such file or directory: 'E:\\apitest\\cases\\cases\\test_api.xlsx' - + File "D:\app\apitest\test_script\test_executor.py", line 62, in test_api + self.action.execute_validation(excel, sheet, iid, name, desc, expected)-test_api (unittest.loader._FailedTest)执行——>【错误Error】 +File "D:\app\apitest\common\utils\action.py", line 89, in execute_validation + raise e+ +File "D:\app\apitest\common\utils\action.py", line 83, in execute_validation + self.run_validate(expected, self.response_json) ++ + +File "D:\app\apitest\common\validation\validator.py", line 115, in run_validate + self.validate(resp) ++ + +File "D:\app\apitest\common\validation\validator.py", line 87, in validate + raise e ++ + +File "D:\app\apitest\common\validation\validator.py", line 83, in validate + fun(actual_value=actual_value, expect_value=expect_value) ++ + +File "D:\app\apitest\common\validation\comparators.py", line 24, in eq + assert actual_value == expect_value, f"预期结果:{actual_value},实际结果:{expect_value}" ++ + +AssertionError: 预期结果:200,实际结果:200 ++ + +
| 第1次发送请求的参数: {'params': None, 'headers': '{"Content-Type":"application/json;charset=utf-8","token":"QpwL5tke4Pnpja7X4"}'} +| 请求地址 --> https://reqres.in/api/users/4 +| 请求头 --> {'Content-Type': 'application/json;charset=utf-8', 'token': 'QpwL5tke4Pnpja7X4'} +| 请求 body --> None +| 接口状态--> 200 +| 接口耗时--> 0:00:00.218369 +| 接口响应--> {"data":{"id":4,"email":"eve.holt@reqres.in","first_name":"Eve","last_name":"Holt","avatar":"https://reqres.in/img/faces/4-image.jpg"},"support":{"url":"https://reqres.in/#support-heading","text":"To keep ReqRes free, contributions towards server costs are appreciated!"}} +| 断言结果-->[{'检查项': '$.data.id', '期望值': 4, '实际值': 4, '断言方法': 'eq:实际值与期望值相等', '断言结果': '通过'}, {'检查项': '$.data.email', '期望值': 'eve.holt@reqres.in', '实际值': 'eve.holt@reqres.in', '断言方法': 'eq:实际值与期望值相等', '断言结果': '通过'}, {'检查项': '200', '期望值': '200', '实际值': '200', '断言方法': 'eq:实际值与期望值相等', '断言结果': '通过'}] + +test_api_005_用户列表 (test_executor.TestProjectApi)执行——>【通过】 ++ + +
这个测试用例听说泡面比较好吃,所以放弃执行了!!+
测试结果汇总
+图表展示
+ + +详细信息
+编号 | ++ 测试类 + + + | + +测试方法 | +用例描述 | +执行时间 | ++ + 执行结果 + + + | +详细信息 | +|||
---|---|---|---|---|---|---|---|---|---|
{{ loop.index }} | +{{ foo.class_name }} | +{{ foo.method_name }} | +{{ foo.method_doc }} | +{{ foo.run_time }} | + {% if foo.state == '成功' %} +{{ foo.state }} | + {% elif foo.state == '失败' %} +{{ foo.state }} | + {% elif foo.state == '错误' %} +{{ foo.state }} | + {% else %} +{{ foo.state }} | + {% endif %} ++ + | +
+ {% for item in foo.run_info %}
+
+ {{ item }}+ {% endfor %} + {% if foo.run_info == [] %} + 无内容输出!+ {% endif %} + |
+