| 执行 sql 成功--> {'select_one': [{'e_name': 'Ben', 'e_salary': 5000, 'e_dep': 'b2'}]} -pm----------------> {'Url': '/api/register', 'Headers': '{"Content-Type": "application/json"}', 'QueryString': None, 'RequestDataType': 'json', 'RequestData': '{"email": "{{email}}", "password": "{{password}}"}', 'Response': '', 'Assertion': '', 'ErrorLog': '', 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:00.883644 -| 接口响应--> {"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:01.099646 -| 接口响应--> {"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:01.099646 -接口响应--> {"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.231025 -| 接口响应--> {"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):@@ -889,35 +919,144 @@ test_api_004_用户列表 (test_executor.TestProjectApi)执行——>【失败 return func(self, params, *args, **kwargs) -
File "D:\app\apitest\test_script\test_executor.py", line 60, in test_api - self.action.execute_validation(excel, sheet, iid, name, desc, expected) +File "D:\app\apitest\test_script\test_executor.py", line 57, in test_api + self.action.send_request(host, url, method, teardown_script, **kwargs)-File "D:\app\apitest\common\utils\action.py", line 89, in execute_validation - raise e +File "D:\app\apitest\common\utils\action.py", line 64, in send_request + self.http_client(host, url, method, **kwargs)-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\utils\decorators.py", line 63, in wrapper + raise RequestSendingError(kwargs, e)-File "D:\app\apitest\common\validation\validator.py", line 115, in run_validate - self.validate(resp) +common.utils.exceptions.RequestSendingError: 请求异常:request_info={'json': '{"email": "eve.holt@reqres.in", "password": "pistol"}', 'headers': '{"Content-Type": "application/json"}', 'params': None}, 原因=HTTPSConnectionPool(host='reqres.in', port=443): Max retries exceeded with url: /api/register (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))))-File "D:\app\apitest\common\validation\validator.py", line 87, in validate - raise e +| 执行 sql 成功--> {'select_one': [{'e_name': 'Ben', 'e_salary': 5000, 'e_dep': 'b2'}]} +pm----------------> {'Url': '/api/register', 'Headers': '{"Content-Type": "application/json"}', 'QueryString': None, 'RequestDataType': 'json', 'RequestData': '{"email": "{{email}}", "password": "{{password}}"}', 'Response': '', 'Assertion': '', 'ErrorLog': '', None: None} +| 第1次发送请求的参数:(Action(), 'https://reqres.in', '/api/register', 'post') -- {'json': '{"email": "eve.holt@reqres.in", "password": "pistol"}', 'headers': '{"Content-Type": "application/json"}', 'params': None} +| 第2次发送请求的参数:(Action(), 'https://reqres.in', '/api/register', 'post') -- {'json': '{"email": "eve.holt@reqres.in", "password": "pistol"}', 'headers': '{"Content-Type": "application/json"}', 'params': None} +test_api_002_注册 (test_executor.TestProjectApi)执行——>【错误Error】-File "D:\app\apitest\common\validation\validator.py", line 83, in validate - fun(actual_value=actual_value, expect_value=expect_value) + +
Traceback (most recent call last):-
File "D:\app\apitest\common\validation\comparators.py", line 24, in eq - assert actual_value == expect_value, f"预期结果:{actual_value},实际结果:{expect_value}" +File "D:\Program Files\python39\lib\unittest\case.py", line 59, in testPartExecutor + yield-AssertionError: 预期结果:200,实际结果:200 +File "D:\Program Files\python39\lib\unittest\case.py", line 593, in run + self._callTestMethod(testMethod) ++ +File "D:\Program Files\python39\lib\unittest\case.py", line 550, in _callTestMethod + method() ++ +File "D:\app\apitest\common\core\dataDriver.py", line 43, in wrapper + return func(self, params, *args, **kwargs) ++ +File "D:\app\apitest\test_script\test_executor.py", line 57, in test_api + self.action.send_request(host, url, method, teardown_script, **kwargs) ++ +File "D:\app\apitest\common\utils\action.py", line 64, in send_request + self.http_client(host, url, method, **kwargs) ++ +File "D:\app\apitest\common\utils\decorators.py", line 63, in wrapper + raise RequestSendingError(kwargs, e) ++ +common.utils.exceptions.RequestSendingError: 请求异常:request_info={'json': '{"email": "eve.holt@reqres.in", "password": "pistol"}', 'headers': '{"Content-Type": "application/json"}', 'params': None}, 原因=HTTPSConnectionPool(host='reqres.in', port=443): Max retries exceeded with url: /api/login (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))) ++ +| 第1次发送请求的参数:(Action(), 'https://reqres.in', '/api/login', 'post') -- {'json': '{"email": "eve.holt@reqres.in", "password": "pistol"}', 'headers': '{"Content-Type": "application/json"}', 'params': None} +| 第2次发送请求的参数:(Action(), 'https://reqres.in', '/api/login', 'post') -- {'json': '{"email": "eve.holt@reqres.in", "password": "pistol"}', 'headers': '{"Content-Type": "application/json"}', 'params': None} +test_api_003_登录 (test_executor.TestProjectApi)执行——>【错误Error】 ++ + +
Traceback (most recent call last): ++ +
File "D:\Program Files\python39\lib\unittest\case.py", line 59, in testPartExecutor + yield ++ +
File "D:\Program Files\python39\lib\unittest\case.py", line 593, in run + self._callTestMethod(testMethod) ++ +
File "D:\Program Files\python39\lib\unittest\case.py", line 550, in _callTestMethod + method() ++ +
File "D:\app\apitest\common\core\dataDriver.py", line 43, in wrapper + return func(self, params, *args, **kwargs) ++ +
File "D:\app\apitest\test_script\test_executor.py", line 57, in test_api + self.action.send_request(host, url, method, teardown_script, **kwargs) ++ +
File "D:\app\apitest\common\utils\action.py", line 64, in send_request + self.http_client(host, url, method, **kwargs) ++ +
File "D:\app\apitest\common\utils\decorators.py", line 63, in wrapper + raise RequestSendingError(kwargs, e) ++ +
common.utils.exceptions.RequestSendingError: 请求异常:request_info={'params': None, 'headers': '{"Content-Type":"application/json;charset=utf-8","token":"{{token}}"}'}, 原因=HTTPSConnectionPool(host='reqres.in', port=443): Max retries exceeded with url: /api/users (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))) ++ +
| 第1次发送请求的参数:(Action(), 'https://reqres.in', '/api/users', 'get') -- {'params': None, 'headers': '{"Content-Type":"application/json;charset=utf-8","token":"{{token}}"}'} +| 第2次发送请求的参数:(Action(), 'https://reqres.in', '/api/users', 'get') -- {'params': None, 'headers': '{"Content-Type":"application/json;charset=utf-8","token":"{{token}}"}'} +test_api_004_用户列表 (test_executor.TestProjectApi)执行——>【错误Error】@@ -929,9 +1068,9 @@ test_api_004_用户列表 (test_executor.TestProjectApi)执行——>【失败
| 第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.229613 -| 接口响应--> {"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)执行——>【通过】 +Traceback (most recent call last): ++ +File "D:\Program Files\python39\lib\unittest\case.py", line 59, in testPartExecutor + yield ++ +File "D:\Program Files\python39\lib\unittest\case.py", line 593, in run + self._callTestMethod(testMethod) ++ +File "D:\Program Files\python39\lib\unittest\case.py", line 550, in _callTestMethod + method() ++ +File "D:\app\apitest\common\core\dataDriver.py", line 43, in wrapper + return func(self, params, *args, **kwargs) ++ +File "D:\app\apitest\test_script\test_executor.py", line 57, in test_api + self.action.send_request(host, url, method, teardown_script, **kwargs) ++ +File "D:\app\apitest\common\utils\action.py", line 64, in send_request + self.http_client(host, url, method, **kwargs) ++ +File "D:\app\apitest\common\utils\decorators.py", line 63, in wrapper + raise RequestSendingError(kwargs, e) ++ +common.utils.exceptions.RequestSendingError: 请求异常:request_info={'params': None, 'headers': '{"Content-Type":"application/json;charset=utf-8","token":"{{token}}"}'}, 原因=HTTPSConnectionPool(host='reqres.in', port=443): Max retries exceeded with url: /api/users/%7B%7BuserId%7D%7D (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))) ++ +| 第1次发送请求的参数:(Action(), 'https://reqres.in', '/api/users/{{userId}}', 'get') -- {'params': None, 'headers': '{"Content-Type":"application/json;charset=utf-8","token":"{{token}}"}'} +| 第2次发送请求的参数:(Action(), 'https://reqres.in', '/api/users/{{userId}}', 'get') -- {'params': None, 'headers': '{"Content-Type":"application/json;charset=utf-8","token":"{{token}}"}'} +test_api_005_用户列表 (test_executor.TestProjectApi)执行——>【错误Error】@@ -988,16 +1154,16 @@ test_api_005_用户列表 (test_executor.TestProjectApi)执行——>【通过