apiAutoTest/report/data/a0bee56f-a5f2-4e7e-a91e-c18...

1 line
5.8 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": "调试运算新功能,从响应提取后运算", "status": "failed", "statusDetails": {"message": "AssertionError: 断言失败 -|- 实际结果:None || 预期结果: 成功", "trace": "cls = <class 'tools.data_process.DataProcess'>\nresponse = {'data': None, 'meta': {'msg': '用户名已存在', 'status': 400}}\nexpect_str = '{\"$.msg\": \"成功\"}'\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_018', '调试运算新功能,从响应提取后运算', 'users/', '读', 'post', 'data', ...]\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 = '{\"$.msg\": \"成功\"}'\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 || 预期结果: 成功\n\ntools\\data_process.py:120: AssertionError"}, "steps": [{"name": "请求地址", "status": "passed", "attachments": [{"name": "请求地址", "source": "c30c585c-6a7f-4c69-bd09-f14922117573-attachment.txt", "type": "text/plain"}], "start": 1611727380944, "stop": 1611727380945}, {"name": "请求头", "status": "passed", "attachments": [{"name": "请求头", "source": "0e337183-867e-4b58-b7f8-da1492c8670e-attachment.txt", "type": "text/plain"}], "start": 1611727380945, "stop": 1611727380945}, {"name": "请求参数", "status": "passed", "attachments": [{"name": "请求参数", "source": "f4e82baa-2813-4450-b201-8840477ba793-attachment.txt", "type": "text/plain"}], "start": 1611727380945, "stop": 1611727380946}, {"name": "上传文件", "status": "passed", "attachments": [{"name": "上传文件", "source": "84046838-43c6-47e3-9f22-4f42e894bc31-attachment.txt", "type": "text/plain"}], "start": 1611727380946, "stop": 1611727380946}, {"name": "响应耗时(s)", "status": "passed", "attachments": [{"name": "响应耗时(s)", "source": "e3a0ae71-95d8-44f0-9b07-63f1da8963c1-attachment.txt", "type": "text/plain"}], "start": 1611727380983, "stop": 1611727380984}, {"name": "响应内容", "status": "passed", "attachments": [{"name": "响应内容", "source": "2e29c97f-a3ed-4364-bf3e-f7df8261c01a-attachment.txt", "type": "text/plain"}], "start": 1611727380985, "stop": 1611727380985}, {"name": "存储实际响应", "status": "passed", "attachments": [{"name": "存储实际响应", "source": "3fef1ede-ed09-4e59-a8f7-d35b455569dd-attachment.txt", "type": "text/plain"}], "start": 1611727380986, "stop": 1611727380986}, {"name": "第1个断言", "status": "passed", "attachments": [{"name": "第1个断言", "source": "c701b986-55da-4820-97bf-706fce52a584-attachment.txt", "type": "text/plain"}], "start": 1611727380987, "stop": 1611727380988}], "attachments": [{"name": "stderr", "source": "bbd2eeda-08d1-4236-ba7e-1860c1631eba-attachment.txt", "type": "text/plain"}], "parameters": [{"name": "cases", "value": "['case_018', '调试运算新功能,从响应提取后运算', 'users/', '读', 'post', 'data', '', '{\"username\": \"tery\",\"password\": eval`&$.case_002.data.id&+500`}', '', '{\"$.msg\": \"成功\"}']"}], "start": 1611727380944, "stop": 1611727380988, "uuid": "ea045a75-83ae-4b42-9f99-2a42d2c16f6f", "historyId": "0d3dd93f9d173bd3e59f983349bd1202", "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"}]}