apiAutoTest/report/data/93e78270-004f-46e9-8fa9-d30...

1 line
5.7 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"name": "get请求实现登录", "status": "failed", "statusDetails": {"message": "AssertionError: 断言失败 -|- 实际结果:None || 预期结果: 400", "trace": "cls = <class 'tools.data_process.DataProcess'>\nresponse = {'data': None, 'meta': {'msg': '参数错误', 'status': 400}}\nexpect_str = '{\"$.meta.code\":400}'\n\n @classmethod\n def assert_result(cls, response: dict, expect_str: str):\n \"\"\" 预期结果实际结果断言方法\n :param response: 实际响应结果\n :param expect_str: 预期响应内容从excel中读取\n return None\n \"\"\"\n # 后置sql变量转换\n expect_str = rep_expr(expect_str, DataProcess.response_dict)\n expect_dict = convert_json(expect_str)\n index = 0\n for k, v in expect_dict.items():\n # 获取需要断言的实际结果部分\n actual = extractor(response, k)\n index += 1\n logger.info(f'第{index}个断言,实际结果:{actual} | 预期结果:{v} \\n断言结果 {actual == v}')\n allure_step(f'第{index}个断言', f'实际结果:{actual} = 预期结果:{v}')\n try:\n> assert actual == v\nE AssertionError\n\ntools\\data_process.py:118: AssertionError\n\nDuring handling of the above exception, another exception occurred:\n\ncases = ['case_001', 'get请求实现登录', 'login', '', 'get', 'params', ...]\n\n def test_main(cases): # 不使用数据库功能\n # 发送请求\n response, expect, sql = BaseRequest.send_request(cases)\n # 断言操作\n> DataProcess.assert_result(response, expect)\n\ntest\\test_api.py:35: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\ncls = <class 'tools.data_process.DataProcess'>\nresponse = {'data': None, 'meta': {'msg': '参数错误', 'status': 400}}\nexpect_str = '{\"$.meta.code\":400}'\n\n @classmethod\n def assert_result(cls, response: dict, expect_str: str):\n \"\"\" 预期结果实际结果断言方法\n :param response: 实际响应结果\n :param expect_str: 预期响应内容从excel中读取\n return None\n \"\"\"\n # 后置sql变量转换\n expect_str = rep_expr(expect_str, DataProcess.response_dict)\n expect_dict = convert_json(expect_str)\n index = 0\n for k, v in expect_dict.items():\n # 获取需要断言的实际结果部分\n actual = extractor(response, k)\n index += 1\n logger.info(f'第{index}个断言,实际结果:{actual} | 预期结果:{v} \\n断言结果 {actual == v}')\n allure_step(f'第{index}个断言', f'实际结果:{actual} = 预期结果:{v}')\n try:\n assert actual == v\n except AssertionError:\n> raise AssertionError(f'断言失败 -|- 实际结果:{actual} || 预期结果: {v}')\nE AssertionError: 断言失败 -|- 实际结果:None || 预期结果: 400\n\ntools\\data_process.py:120: AssertionError"}, "steps": [{"name": "请求地址", "status": "passed", "attachments": [{"name": "请求地址", "source": "ae783cab-73ad-4357-8013-2cfc5cefff4c-attachment.txt", "type": "text/plain"}], "start": 1611727379651, "stop": 1611727379652}, {"name": "请求头", "status": "passed", "attachments": [{"name": "请求头", "source": "5a400654-dd7c-4e51-aa6d-4817ce7d424e-attachment.txt", "type": "text/plain"}], "start": 1611727379652, "stop": 1611727379653}, {"name": "请求参数", "status": "passed", "attachments": [{"name": "请求参数", "source": "0691f7e8-e3c5-4063-9af3-5bade3dd8d88-attachment.txt", "type": "text/plain"}], "start": 1611727379653, "stop": 1611727379661}, {"name": "上传文件", "status": "passed", "attachments": [{"name": "上传文件", "source": "17138956-e345-4d15-8129-f2f821112953-attachment.txt", "type": "text/plain"}], "start": 1611727379661, "stop": 1611727379662}, {"name": "响应耗时(s)", "status": "passed", "attachments": [{"name": "响应耗时(s)", "source": "5aa5ff6a-ca4c-41ad-a028-c0685c3a84d5-attachment.txt", "type": "text/plain"}], "start": 1611727379755, "stop": 1611727379756}, {"name": "响应内容", "status": "passed", "attachments": [{"name": "响应内容", "source": "cecbe4d8-1060-4439-83fb-cd35585ba8f7-attachment.txt", "type": "text/plain"}], "start": 1611727379756, "stop": 1611727379757}, {"name": "存储实际响应", "status": "passed", "attachments": [{"name": "存储实际响应", "source": "badd9c35-259c-4344-b930-a7fbf98f7f0c-attachment.txt", "type": "text/plain"}], "start": 1611727379758, "stop": 1611727379759}, {"name": "第1个断言", "status": "passed", "attachments": [{"name": "第1个断言", "source": "971c697a-1b0d-483e-a523-4cb67da8a01c-attachment.txt", "type": "text/plain"}], "start": 1611727379760, "stop": 1611727379761}], "attachments": [{"name": "stderr", "source": "d1349b19-a79d-44fc-8d18-cbc1c637c1a0-attachment.txt", "type": "text/plain"}], "parameters": [{"name": "cases", "value": "['case_001', 'get请求实现登录', 'login', '', 'get', 'params', '', '{\"username\": \"admin\", \"password\": \"\"}', '', '{\"$.meta.code\":400}']"}], "start": 1611727379651, "stop": 1611727379762, "uuid": "578d6b64-d1d8-4756-9309-25a3cb287116", "historyId": "8174f8ecb1004db16679a852ff5f760a", "testCaseId": "881516e7ef2e2aa5436f6a3c3e6a5bcb", "fullName": "test.test_api#test_main", "labels": [{"name": "parentSuite", "value": "test"}, {"name": "suite", "value": "test_api"}, {"name": "host", "value": "LAPTOP-FR8LEA9G"}, {"name": "thread", "value": "5708-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "test.test_api"}]}