forked from DxvLwRYF/apiAutoTest
1 line
6.0 KiB
JSON
1 line
6.0 KiB
JSON
{"name": "调试运算新功能,从path需要运算", "status": "failed", "statusDetails": {"message": "AssertionError: 断言失败 -|- 实际结果:{'msg': '更新失败', 'status': 400} || 预期结果: {'msg': '设置状态成功', 'status': 200}", "trace": "cls = <class 'tools.data_process.DataProcess'>\nresponse = {'data': None, 'meta': {'msg': '更新失败', 'status': 400}}\nexpect_str = '{\"$.meta\":{\"msg\": \"设置状态成功\", \"status\": 200}}'\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_019', '调试运算新功能,从path需要运算', 'users/eval`&$.case_005.data.id&*2`/', '读', 'put', '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 = '{\"$.meta\":{\"msg\": \"设置状态成功\", \"status\": 200}}'\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: 断言失败 -|- 实际结果:{'msg': '更新失败', 'status': 400} || 预期结果: {'msg': '设置状态成功', 'status': 200}\n\ntools\\data_process.py:120: AssertionError"}, "steps": [{"name": "请求地址", "status": "passed", "attachments": [{"name": "请求地址", "source": "9950427b-7951-4da6-9a62-a0dc7e2cfc70-attachment.txt", "type": "text/plain"}], "start": 1611727380998, "stop": 1611727380999}, {"name": "请求头", "status": "passed", "attachments": [{"name": "请求头", "source": "c3bed1bc-6e70-4177-962b-c65a92ec1c5f-attachment.txt", "type": "text/plain"}], "start": 1611727380999, "stop": 1611727380999}, {"name": "请求参数", "status": "passed", "attachments": [{"name": "请求参数", "source": "0c091fc7-c2be-4551-9016-9ee61997b7e1-attachment.txt", "type": "text/plain"}], "start": 1611727380999, "stop": 1611727381000}, {"name": "上传文件", "status": "passed", "attachments": [{"name": "上传文件", "source": "d0ac0799-bc3b-4be2-9380-5ff75181cf06-attachment.txt", "type": "text/plain"}], "start": 1611727381000, "stop": 1611727381000}, {"name": "响应耗时(s)", "status": "passed", "attachments": [{"name": "响应耗时(s)", "source": "5d9708b6-a786-4d09-b7f5-358e9486b2bb-attachment.txt", "type": "text/plain"}], "start": 1611727381038, "stop": 1611727381039}, {"name": "响应内容", "status": "passed", "attachments": [{"name": "响应内容", "source": "d02d9f95-0dfd-4cce-a174-647c44d000d3-attachment.txt", "type": "text/plain"}], "start": 1611727381039, "stop": 1611727381040}, {"name": "存储实际响应", "status": "passed", "attachments": [{"name": "存储实际响应", "source": "a98930f1-0adf-4c18-9fa6-53766dc1c98e-attachment.txt", "type": "text/plain"}], "start": 1611727381041, "stop": 1611727381042}, {"name": "第1个断言", "status": "passed", "attachments": [{"name": "第1个断言", "source": "6f71faad-130d-40bc-a0ff-c599b39bc459-attachment.txt", "type": "text/plain"}], "start": 1611727381043, "stop": 1611727381043}], "attachments": [{"name": "stderr", "source": "9664fd4b-46ee-4515-ba2f-a6eaceb80e04-attachment.txt", "type": "text/plain"}], "parameters": [{"name": "cases", "value": "['case_019', '调试运算新功能,从path需要运算', 'users/eval`&$.case_005.data.id&*2`/', '读', 'put', 'data', '', '', '', '{\"$.meta\":{\"msg\": \"设置状态成功\", \"status\": 200}}']"}], "start": 1611727380998, "stop": 1611727381044, "uuid": "5afeaf9c-d24a-4ec8-bfc7-b84646fb008e", "historyId": "5a1a59aa4470006c7c58a5ba625a4478", "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"}]} |