|
@@ -0,0 +1,2740 @@
|
|
|
+2024-11-04 20:25:36 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '{{username}}', 'password': '{{password}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'通过JSONPATH提取数据-TOKEN': {'关键字': 'ex_jsonData', 'EXVALUE': '$..token', 'INDEX': None, 'VARNAME': 'token'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:能够正确登录用例,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '123456'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:能够正确登录用例,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:能够正确登录用例,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:能够正确登录用例,开始执行步骤3:通过JSONPATH提取数据-TOKEN - {'关键字': 'ex_jsonData', 'EXVALUE': '$..token', 'INDEX': None, 'VARNAME': 'token'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:能够正确登录用例,开始执行步骤4:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:能够正确登录用例,开始执行步骤5:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO -------------------测试用例名称:能够正确登录用例执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:36 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P0] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:36 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:36 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:36 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:36 INFO 用例耗时:0.10566030000000004 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:36 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:36 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '1234562'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '手机号或密码错误!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '1004', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '1234562'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': '手机号或密码错误!', 'EXPECTED': '手机号或密码错误!', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '1004', 'EXPECTED': '1004', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO -------------------测试用例名称:登录失败-手机号或密码错误用例执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:36 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P1] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:36 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:36 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:36 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:36 INFO 用例耗时:0.08426139999999993 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:36 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:36 INFO -----------------开始执行测试用例:[{'发送Get请求': {'关键字': 'request_get', 'URL': '{{URL}}/user/userInfo', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..username', 'INDEX': 0, 'VARNAME': 'msg_username'}}, {'断言-等于-响应USERNAME': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_username}}', 'EXPECTED': '{{username}}', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:查看用户信息,开始执行步骤0:发送Get请求 - {'关键字': 'request_get', 'URL': 'http://120.25.127.201:18001//user/userInfo', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5MzYsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxMzYyMzN9.mrpQ6h4-izAgP-HbalIICX7HU8gSPH7xTJkjVrzLJGPv2X5e0mpRRg1-8elFCs_pn8yjdwolXOYALYsb-E1n1Q'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:查看用户信息,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:查看用户信息,开始执行步骤2:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:查看用户信息,开始执行步骤3:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..username', 'INDEX': 0, 'VARNAME': 'msg_username'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:查看用户信息,开始执行步骤4:断言-等于-响应USERNAME - {'关键字': 'assert_text_comparators', 'VALUE': '15096268001', 'EXPECTED': '15096268001', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO -------------------测试用例名称:查看用户信息执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:36 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P2] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:36 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:36 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:36 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:36 INFO 用例耗时:0.09925839999999986 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:36 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:36 INFO -----------------开始执行测试用例:[{'发送Post请求-上传图片': {'关键字': 'request_post_form_data', 'URL': '{{URL}}/file/picUpload', 'FILES': '{"file":open("./files/20240725223321.png","rb")}', 'PARAMS': None, 'HEADERS': None}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}, {'通过JSONPATH提取数据-图片路径': {'关键字': 'ex_jsonData', 'EXVALUE': '$..data', 'INDEX': 0, 'VARNAME': 'msg_data'}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:修改头像-上传头像,开始执行步骤0:发送Post请求-上传图片 - {'关键字': 'request_post_form_data', 'URL': 'http://120.25.127.201:18001//file/picUpload', 'FILES': '{"file":open("./files/20240725223321.png","rb")}', 'PARAMS': None, 'HEADERS': None} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:修改头像-上传头像,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:修改头像-上传头像,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:修改头像-上传头像,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:修改头像-上传头像,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:修改头像-上传头像,开始执行步骤5:通过JSONPATH提取数据-图片路径 - {'关键字': 'ex_jsonData', 'EXVALUE': '$..data', 'INDEX': 0, 'VARNAME': 'msg_data'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO -------------------测试用例名称:修改头像-上传头像执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:36 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P3] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:36 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:36 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:36 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:36 INFO 用例耗时:0.08409670000000014 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:36 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:36 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/updateUserInfo', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'userPhoto': '{{msg_data}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/updateUserInfo', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5MzYsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxMzYyMzN9.mrpQ6h4-izAgP-HbalIICX7HU8gSPH7xTJkjVrzLJGPv2X5e0mpRRg1-8elFCs_pn8yjdwolXOYALYsb-E1n1Q'}, 'DATA': {'userPhoto': '/localPic/2024/11/04/aa51dc43ea3448bb91f269fb9c489aa3.png'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO -------------------测试用例名称:修改头像-确定修改头像执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:36 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P4] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:36 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:36 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:36 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:36 INFO 用例耗时:0.11206969999999972 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:36 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:36 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:36 INFO 测试用例名称:我的书评-发布正常的书评(可能会失败),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:36 INFO -------------------测试用例名称:我的书评-发布正常的书评(可能会失败)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:37 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P5] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:37 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:37 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADDBEFA0>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布正常的书评(可能会失败)', 'desc': '我的书评-发布正常的书评(可能会失败)', 'featureName': '我的书评', 'process': 'G0--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:37 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:37 INFO 用例耗时:0.24739699999999987 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:37 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:37 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '', 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '书籍ID不存在', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:37 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5MzYsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxMzYyMzN9.mrpQ6h4-izAgP-HbalIICX7HU8gSPH7xTJkjVrzLJGPv2X5e0mpRRg1-8elFCs_pn8yjdwolXOYALYsb-E1n1Q'}, 'DATA': {'bookId': '', 'commentContent': 'hami的接口自动化'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:37 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:37 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:37 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': '书籍ID不存在', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:37 INFO -------------------测试用例名称:我的书评-发布不存在的书籍ID(BUG)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:37 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P6] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:37 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:37 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADDBE520>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布不存在的书籍ID(BUG)', 'desc': '我的书评-发布不存在的书籍ID(BUG)', 'featureName': '我的书评', 'process': 'G0--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <apirun.extend.keywords.KeyWords object at 0x00000215AE0115B0>
|
|
|
+kwargs = {'EXPECTED': '书籍ID不存在', 'OP_STR': '==', 'VALUE': 'SUCCESS', '关键字': 'assert_text_comparators'}
|
|
|
+comparators = {'!=': <function KeyWords.assert_text_comparators.<locals>.<lambda> at 0x00000215ADFDBA60>, '<': <function KeyWords.as...at 0x00000215ADFDB9D0>, '==': <function KeyWords.assert_text_comparators.<locals>.<lambda> at 0x00000215ADFDB8B0>, ...}
|
|
|
+message = None
|
|
|
+
|
|
|
+ @allure.step("参数数据:断言当前文本内容")
|
|
|
+ def assert_text_comparators(self, **kwargs):
|
|
|
+ """
|
|
|
+ 封装断言以进行不同的比较操作。
|
|
|
+
|
|
|
+ 参数:
|
|
|
+ value (Any): 要比较的值。
|
|
|
+ expected (Any): 预期的值。
|
|
|
+ op_str (str): 操作符的字符串表示(如 '>', '<', '==' 等)。
|
|
|
+ message (str, optional): 自定义的错误消息。
|
|
|
+
|
|
|
+ 返回:
|
|
|
+ None: 如果断言成功,则不返回任何内容。
|
|
|
+
|
|
|
+ 引发:
|
|
|
+ AssertionError: 如果断言失败。
|
|
|
+ """
|
|
|
+ comparators = {
|
|
|
+ '>': lambda a, b: a > b,
|
|
|
+ '<': lambda a, b: a < b,
|
|
|
+ '==': lambda a, b: a == b,
|
|
|
+ '>=': lambda a, b: a >= b,
|
|
|
+ '<=': lambda a, b: a <= b,
|
|
|
+ '!=': lambda a, b: a != b,
|
|
|
+ }
|
|
|
+
|
|
|
+ message = kwargs.get("MESSAGE", None)
|
|
|
+
|
|
|
+ if kwargs["OP_STR"] not in comparators:
|
|
|
+ raise ValueError(f"没有该操作方式: {kwargs['OP_STR']}")
|
|
|
+
|
|
|
+ if not comparators[kwargs['OP_STR']](kwargs['VALUE'], kwargs["EXPECTED"]):
|
|
|
+ if message:
|
|
|
+ raise AssertionError(message)
|
|
|
+ else:
|
|
|
+> raise AssertionError(f"{kwargs['VALUE']} {kwargs['OP_STR']} {kwargs['EXPECTED']} 失败")
|
|
|
+E AssertionError: SUCCESS == 书籍ID不存在 失败
|
|
|
+
|
|
|
+extend\keywords.py:228: AssertionError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:37 INFO 异常:<ExceptionInfo AssertionError('SUCCESS == 书籍ID不存在 失败') tblen=31> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:37 INFO 用例耗时:0.11110720000000018 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:37 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:37 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': 118, 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '已评价过该书籍!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '3001', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:37 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5MzYsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxMzYyMzN9.mrpQ6h4-izAgP-HbalIICX7HU8gSPH7xTJkjVrzLJGPv2X5e0mpRRg1-8elFCs_pn8yjdwolXOYALYsb-E1n1Q'}, 'DATA': {'bookId': 118, 'commentContent': 'hami的接口自动化'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:37 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:37 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:37 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': '已评价过该书籍!', 'EXPECTED': '已评价过该书籍!', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:37 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '3001', 'EXPECTED': '3001', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:37 INFO -------------------测试用例名称:我的书评-发布已评价的数据执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:37 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P7] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:37 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:37 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:37 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:37 INFO 用例耗时:0.09267849999999989 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:37 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:37 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'ham'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:37 INFO 测试用例名称:我的书评-发布不满五个字的书评(BUG),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:37 INFO -------------------测试用例名称:我的书评-发布不满五个字的书评(BUG)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:37 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P8] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:37 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:37 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADDBE190>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布不满五个字的书评(BUG)', 'desc': '我的书评-发布不满五个字的书评(BUG)', 'featureName': '我的书评', 'process': 'G0--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:37 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:37 INFO 用例耗时:0.22507089999999996 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:37 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:37 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhahamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamham'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '评价不能超过200字符!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:37 INFO 测试用例名称:我的书评-发布超过200个字的书评,开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO -------------------测试用例名称:我的书评-发布超过200个字的书评执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:38 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P9] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:38 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:38 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADDBE610>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布超过200个字的书评', 'desc': '我的书评-发布超过200个字的书评', 'featureName': '我的书评', 'process': 'G0--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:38 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:38 INFO 用例耗时:0.2116956000000001 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:38 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:38 INFO -----------------开始执行测试用例:[{'发送Get请求': {'关键字': 'request_get', 'URL': '{{URL}}/book/listClickRank', 'PARAMS': None, 'HEADERS': None}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': None, 'VARNAME': 'msg_success'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤0:发送Get请求 - {'关键字': 'request_get', 'URL': 'http://120.25.127.201:18001//book/listClickRank', 'PARAMS': None, 'HEADERS': None} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': None, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤2:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO -------------------测试用例名称:点击榜单能够显示对应的数据执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:38 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P10] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:38 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:38 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:38 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:38 INFO 用例耗时:0.12249089999999985 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:38 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:38 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hami的接口自动化'}}}, {'JSON断言-等于-响应MSG': {'关键字': 'assert_json_comparators', 'VALUE': '$..msg', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'JSON断言-等于-CODE': {'关键字': 'assert_json_comparators', 'VALUE': '$..code', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:我的书评-发布正常的书评(优化-直接Josn断言),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO -------------------测试用例名称:我的书评-发布正常的书评(优化-直接Josn断言)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:38 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P11] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:38 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:38 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADDBE8B0>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布正常的书评(优化-直接Josn断言)', 'desc': '我的书评-发布正常的书评(优化-直接Josn断言)', 'featureName': '我的书评', 'process': 'G0--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:38 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:38 INFO 用例耗时:0.20688920000000044 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:38 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:38 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '{{username}}', 'password': '{{password}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'通过JSONPATH提取数据-TOKEN': {'关键字': 'ex_jsonData', 'EXVALUE': '$..token', 'INDEX': None, 'VARNAME': 'token'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_能够正确登录用例,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '123456'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_能够正确登录用例,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_能够正确登录用例,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_能够正确登录用例,开始执行步骤3:通过JSONPATH提取数据-TOKEN - {'关键字': 'ex_jsonData', 'EXVALUE': '$..token', 'INDEX': None, 'VARNAME': 'token'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_能够正确登录用例,开始执行步骤4:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_能够正确登录用例,开始执行步骤5:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO -------------------测试用例名称:备份_能够正确登录用例执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:38 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P12] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:38 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:38 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:38 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:38 INFO 用例耗时:0.08122730000000011 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:38 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:38 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '1234562'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '手机号或密码错误!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '1004', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_登录失败-手机号或密码错误用例,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '1234562'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_登录失败-手机号或密码错误用例,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_登录失败-手机号或密码错误用例,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_登录失败-手机号或密码错误用例,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': '手机号或密码错误!', 'EXPECTED': '手机号或密码错误!', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_登录失败-手机号或密码错误用例,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '1004', 'EXPECTED': '1004', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO -------------------测试用例名称:备份_登录失败-手机号或密码错误用例执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:38 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P13] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:38 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:38 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:38 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:38 INFO 用例耗时:0.08275990000000011 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:38 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:38 INFO -----------------开始执行测试用例:[{'发送Get请求': {'关键字': 'request_get', 'URL': '{{URL}}/user/userInfo', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..username', 'INDEX': 0, 'VARNAME': 'msg_username'}}, {'断言-等于-响应USERNAME': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_username}}', 'EXPECTED': '{{username}}', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_查看用户信息,开始执行步骤0:发送Get请求 - {'关键字': 'request_get', 'URL': 'http://120.25.127.201:18001//user/userInfo', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5MzgsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxMzg3MTJ9.iLS16XWs6xTMI6mmdU0SWaeOLjMOSXugU_6ZasD5tqy3Uf4rS71m-RvXGmYoRr-sWXkiw2qJIY9e54Bcc6pOVw'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_查看用户信息,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_查看用户信息,开始执行步骤2:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_查看用户信息,开始执行步骤3:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..username', 'INDEX': 0, 'VARNAME': 'msg_username'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_查看用户信息,开始执行步骤4:断言-等于-响应USERNAME - {'关键字': 'assert_text_comparators', 'VALUE': '15096268001', 'EXPECTED': '15096268001', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO -------------------测试用例名称:备份_查看用户信息执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:38 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P14] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:38 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:38 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:38 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:38 INFO 用例耗时:0.08612210000000076 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:38 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:38 INFO -----------------开始执行测试用例:[{'发送Post请求-上传图片': {'关键字': 'request_post_form_data', 'URL': '{{URL}}/file/picUpload', 'FILES': '{"file":open("./files/20240725223321.png","rb")}', 'PARAMS': None, 'HEADERS': None}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}, {'通过JSONPATH提取数据-图片路径': {'关键字': 'ex_jsonData', 'EXVALUE': '$..data', 'INDEX': 0, 'VARNAME': 'msg_data'}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_修改头像-上传头像,开始执行步骤0:发送Post请求-上传图片 - {'关键字': 'request_post_form_data', 'URL': 'http://120.25.127.201:18001//file/picUpload', 'FILES': '{"file":open("./files/20240725223321.png","rb")}', 'PARAMS': None, 'HEADERS': None} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_修改头像-上传头像,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_修改头像-上传头像,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_修改头像-上传头像,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_修改头像-上传头像,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO 测试用例名称:备份_修改头像-上传头像,开始执行步骤5:通过JSONPATH提取数据-图片路径 - {'关键字': 'ex_jsonData', 'EXVALUE': '$..data', 'INDEX': 0, 'VARNAME': 'msg_data'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:38 INFO -------------------测试用例名称:备份_修改头像-上传头像执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:38 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P15] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:38 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:38 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:38 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:38 INFO 用例耗时:0.07912230000000076 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:38 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:39 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/updateUserInfo', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'userPhoto': '{{msg_data}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_修改头像-确定修改头像,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/updateUserInfo', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5MzgsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxMzg3MTJ9.iLS16XWs6xTMI6mmdU0SWaeOLjMOSXugU_6ZasD5tqy3Uf4rS71m-RvXGmYoRr-sWXkiw2qJIY9e54Bcc6pOVw'}, 'DATA': {'userPhoto': '/localPic/2024/11/04/058a645adf1640e4a9e857d75a4fbb31.png'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_修改头像-确定修改头像,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_修改头像-确定修改头像,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_修改头像-确定修改头像,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_修改头像-确定修改头像,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO -------------------测试用例名称:备份_修改头像-确定修改头像执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:39 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P16] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:39 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:39 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:39 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:39 INFO 用例耗时:0.10777579999999976 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:39 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:39 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布正常的书评(可能会失败),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO -------------------测试用例名称:备份_我的书评-发布正常的书评(可能会失败)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:39 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P17] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:39 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:39 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADE27280>
|
|
|
+caseinfo = {'_case_name': '备份_我的书评-发布正常的书评(可能会失败)', 'desc': '备份_我的书评-发布正常的书评(可能会失败)', 'featureName': '我的书评', 'process': 'G0--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:39 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:39 INFO 用例耗时:0.21631909999999976 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:39 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:39 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '', 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '书籍ID不存在', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布不存在的书籍ID(BUG),开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5MzgsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxMzg3MTJ9.iLS16XWs6xTMI6mmdU0SWaeOLjMOSXugU_6ZasD5tqy3Uf4rS71m-RvXGmYoRr-sWXkiw2qJIY9e54Bcc6pOVw'}, 'DATA': {'bookId': '', 'commentContent': 'hami的接口自动化'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布不存在的书籍ID(BUG),开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布不存在的书籍ID(BUG),开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布不存在的书籍ID(BUG),开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': '书籍ID不存在', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO -------------------测试用例名称:备份_我的书评-发布不存在的书籍ID(BUG)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:39 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P18] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:39 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:39 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADE27DC0>
|
|
|
+caseinfo = {'_case_name': '备份_我的书评-发布不存在的书籍ID(BUG)', 'desc': '备份_我的书评-发布不存在的书籍ID(BUG)', 'featureName': '我的书评', 'process': 'G0--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <apirun.extend.keywords.KeyWords object at 0x00000215ADFD67F0>
|
|
|
+kwargs = {'EXPECTED': '书籍ID不存在', 'OP_STR': '==', 'VALUE': 'SUCCESS', '关键字': 'assert_text_comparators'}
|
|
|
+comparators = {'!=': <function KeyWords.assert_text_comparators.<locals>.<lambda> at 0x00000215ADFCBDC0>, '<': <function KeyWords.as...at 0x00000215ADFCB040>, '==': <function KeyWords.assert_text_comparators.<locals>.<lambda> at 0x00000215ADFCB670>, ...}
|
|
|
+message = None
|
|
|
+
|
|
|
+ @allure.step("参数数据:断言当前文本内容")
|
|
|
+ def assert_text_comparators(self, **kwargs):
|
|
|
+ """
|
|
|
+ 封装断言以进行不同的比较操作。
|
|
|
+
|
|
|
+ 参数:
|
|
|
+ value (Any): 要比较的值。
|
|
|
+ expected (Any): 预期的值。
|
|
|
+ op_str (str): 操作符的字符串表示(如 '>', '<', '==' 等)。
|
|
|
+ message (str, optional): 自定义的错误消息。
|
|
|
+
|
|
|
+ 返回:
|
|
|
+ None: 如果断言成功,则不返回任何内容。
|
|
|
+
|
|
|
+ 引发:
|
|
|
+ AssertionError: 如果断言失败。
|
|
|
+ """
|
|
|
+ comparators = {
|
|
|
+ '>': lambda a, b: a > b,
|
|
|
+ '<': lambda a, b: a < b,
|
|
|
+ '==': lambda a, b: a == b,
|
|
|
+ '>=': lambda a, b: a >= b,
|
|
|
+ '<=': lambda a, b: a <= b,
|
|
|
+ '!=': lambda a, b: a != b,
|
|
|
+ }
|
|
|
+
|
|
|
+ message = kwargs.get("MESSAGE", None)
|
|
|
+
|
|
|
+ if kwargs["OP_STR"] not in comparators:
|
|
|
+ raise ValueError(f"没有该操作方式: {kwargs['OP_STR']}")
|
|
|
+
|
|
|
+ if not comparators[kwargs['OP_STR']](kwargs['VALUE'], kwargs["EXPECTED"]):
|
|
|
+ if message:
|
|
|
+ raise AssertionError(message)
|
|
|
+ else:
|
|
|
+> raise AssertionError(f"{kwargs['VALUE']} {kwargs['OP_STR']} {kwargs['EXPECTED']} 失败")
|
|
|
+E AssertionError: SUCCESS == 书籍ID不存在 失败
|
|
|
+
|
|
|
+extend\keywords.py:228: AssertionError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:39 INFO 异常:<ExceptionInfo AssertionError('SUCCESS == 书籍ID不存在 失败') tblen=31> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:39 INFO 用例耗时:0.11749030000000005 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:39 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:39 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': 118, 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '已评价过该书籍!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '3001', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布已评价的数据,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5MzgsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxMzg3MTJ9.iLS16XWs6xTMI6mmdU0SWaeOLjMOSXugU_6ZasD5tqy3Uf4rS71m-RvXGmYoRr-sWXkiw2qJIY9e54Bcc6pOVw'}, 'DATA': {'bookId': 118, 'commentContent': 'hami的接口自动化'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布已评价的数据,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布已评价的数据,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布已评价的数据,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': '已评价过该书籍!', 'EXPECTED': '已评价过该书籍!', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布已评价的数据,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '3001', 'EXPECTED': '3001', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO -------------------测试用例名称:备份_我的书评-发布已评价的数据执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:39 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P19] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:39 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:39 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:39 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:39 INFO 用例耗时:0.10991980000000012 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:39 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:39 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'ham'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布不满五个字的书评(BUG),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:39 INFO -------------------测试用例名称:备份_我的书评-发布不满五个字的书评(BUG)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:39 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P20] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:39 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:39 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADE27940>
|
|
|
+caseinfo = {'_case_name': '备份_我的书评-发布不满五个字的书评(BUG)', 'desc': '备份_我的书评-发布不满五个字的书评(BUG)', 'featureName': '我的书评', 'process': 'G0--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:39 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:39 INFO 用例耗时:0.20216299999999965 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:39 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:39 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhahamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamham'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '评价不能超过200字符!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:39 INFO 测试用例名称:备份_我的书评-发布超过200个字的书评,开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO -------------------测试用例名称:备份_我的书评-发布超过200个字的书评执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:40 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P21] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:40 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:40 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADE27760>
|
|
|
+caseinfo = {'_case_name': '备份_我的书评-发布超过200个字的书评', 'desc': '备份_我的书评-发布超过200个字的书评', 'featureName': '我的书评', 'process': 'G0--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:40 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:40 INFO 用例耗时:0.2145910999999998 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:40 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:40 INFO -----------------开始执行测试用例:[{'发送Get请求': {'关键字': 'request_get', 'URL': '{{URL}}/book/listClickRank', 'PARAMS': None, 'HEADERS': None}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': None, 'VARNAME': 'msg_success'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:备份_点击榜单能够显示对应的数据,开始执行步骤0:发送Get请求 - {'关键字': 'request_get', 'URL': 'http://120.25.127.201:18001//book/listClickRank', 'PARAMS': None, 'HEADERS': None} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:备份_点击榜单能够显示对应的数据,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': None, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:备份_点击榜单能够显示对应的数据,开始执行步骤2:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO -------------------测试用例名称:备份_点击榜单能够显示对应的数据执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:40 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P22] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:40 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:40 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:40 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:40 INFO 用例耗时:0.12154480000000056 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:40 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:40 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hami的接口自动化'}}}, {'JSON断言-等于-响应MSG': {'关键字': 'assert_json_comparators', 'VALUE': '$..msg', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'JSON断言-等于-CODE': {'关键字': 'assert_json_comparators', 'VALUE': '$..code', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:备份_我的书评-发布正常的书评(优化-直接Josn断言),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO -------------------测试用例名称:备份_我的书评-发布正常的书评(优化-直接Josn断言)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:40 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G0--P23] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:40 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:40 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADE27B20>
|
|
|
+caseinfo = {'_case_name': '备份_我的书评-发布正常的书评(优化-直接Josn断言)', 'desc': '备份_我的书评-发布正常的书评(优化-直接Josn断言)', 'featureName': '我的书评', 'process': 'G0--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:40 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:40 INFO 用例耗时:0.2079285999999998 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:40 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:40 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '{{username}}', 'password': '{{password}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'通过JSONPATH提取数据-TOKEN': {'关键字': 'ex_jsonData', 'EXVALUE': '$..token', 'INDEX': None, 'VARNAME': 'token'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:能够正确登录用例,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '123456'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:能够正确登录用例,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:能够正确登录用例,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:能够正确登录用例,开始执行步骤3:通过JSONPATH提取数据-TOKEN - {'关键字': 'ex_jsonData', 'EXVALUE': '$..token', 'INDEX': None, 'VARNAME': 'token'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:能够正确登录用例,开始执行步骤4:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:能够正确登录用例,开始执行步骤5:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO -------------------测试用例名称:能够正确登录用例执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:40 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P0] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:40 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:40 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:40 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:40 INFO 用例耗时:0.08391579999999976 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:40 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:40 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '1234562'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '手机号或密码错误!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '1004', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '1234562'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': '手机号或密码错误!', 'EXPECTED': '手机号或密码错误!', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '1004', 'EXPECTED': '1004', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:40 INFO -------------------测试用例名称:登录失败-手机号或密码错误用例执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:40 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P1] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:40 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:40 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:40 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:40 INFO 用例耗时:0.08588750000000012 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:40 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:40 INFO -----------------开始执行测试用例:[{'发送Get请求': {'关键字': 'request_get', 'URL': '{{URL}}/user/userInfo', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..username', 'INDEX': 0, 'VARNAME': 'msg_username'}}, {'断言-等于-响应USERNAME': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_username}}', 'EXPECTED': '{{username}}', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:40 INFO 测试用例名称:查看用户信息,开始执行步骤0:发送Get请求 - {'关键字': 'request_get', 'URL': 'http://120.25.127.201:18001//user/userInfo', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDAsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDA4MDd9.SD_JAbmSzzYUHTkOi-Z3eBNl7-3eLJ5-znJJUJgyrm0Bl-vi2HrowFGwpzuBuPZblEJ4XiOMIADyamEEf08QwQ'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:查看用户信息,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:查看用户信息,开始执行步骤2:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:查看用户信息,开始执行步骤3:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..username', 'INDEX': 0, 'VARNAME': 'msg_username'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:查看用户信息,开始执行步骤4:断言-等于-响应USERNAME - {'关键字': 'assert_text_comparators', 'VALUE': '15096268001', 'EXPECTED': '15096268001', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO -------------------测试用例名称:查看用户信息执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:41 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P2] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:41 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:41 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:41 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:41 INFO 用例耗时:0.08128289999999971 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:41 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:41 INFO -----------------开始执行测试用例:[{'发送Post请求-上传图片': {'关键字': 'request_post_form_data', 'URL': '{{URL}}/file/picUpload', 'FILES': '{"file":open("./files/20240725223321.png","rb")}', 'PARAMS': None, 'HEADERS': None}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}, {'通过JSONPATH提取数据-图片路径': {'关键字': 'ex_jsonData', 'EXVALUE': '$..data', 'INDEX': 0, 'VARNAME': 'msg_data'}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:修改头像-上传头像,开始执行步骤0:发送Post请求-上传图片 - {'关键字': 'request_post_form_data', 'URL': 'http://120.25.127.201:18001//file/picUpload', 'FILES': '{"file":open("./files/20240725223321.png","rb")}', 'PARAMS': None, 'HEADERS': None} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:修改头像-上传头像,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:修改头像-上传头像,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:修改头像-上传头像,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:修改头像-上传头像,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:修改头像-上传头像,开始执行步骤5:通过JSONPATH提取数据-图片路径 - {'关键字': 'ex_jsonData', 'EXVALUE': '$..data', 'INDEX': 0, 'VARNAME': 'msg_data'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO -------------------测试用例名称:修改头像-上传头像执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:41 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P3] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:41 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:41 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:41 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:41 INFO 用例耗时:0.08287570000000066 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:41 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:41 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/updateUserInfo', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'userPhoto': '{{msg_data}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/updateUserInfo', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDAsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDA4MDd9.SD_JAbmSzzYUHTkOi-Z3eBNl7-3eLJ5-znJJUJgyrm0Bl-vi2HrowFGwpzuBuPZblEJ4XiOMIADyamEEf08QwQ'}, 'DATA': {'userPhoto': '/localPic/2024/11/04/d56a313d79204bd5a200b6604b6af8ac.png'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO -------------------测试用例名称:修改头像-确定修改头像执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:41 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P4] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:41 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:41 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:41 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:41 INFO 用例耗时:0.08997049999999973 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:41 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:41 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:我的书评-发布正常的书评(可能会失败),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO -------------------测试用例名称:我的书评-发布正常的书评(可能会失败)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:41 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P5] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:41 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:41 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADE27100>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布正常的书评(可能会失败)', 'desc': '我的书评-发布正常的书评(可能会失败)', 'featureName': '我的书评', 'process': 'G1--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:41 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:41 INFO 用例耗时:0.2237430000000007 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:41 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:41 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '', 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '书籍ID不存在', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDAsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDA4MDd9.SD_JAbmSzzYUHTkOi-Z3eBNl7-3eLJ5-znJJUJgyrm0Bl-vi2HrowFGwpzuBuPZblEJ4XiOMIADyamEEf08QwQ'}, 'DATA': {'bookId': '', 'commentContent': 'hami的接口自动化'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': '书籍ID不存在', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO -------------------测试用例名称:我的书评-发布不存在的书籍ID(BUG)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:41 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P6] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:41 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:41 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215AD7ED520>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布不存在的书籍ID(BUG)', 'desc': '我的书评-发布不存在的书籍ID(BUG)', 'featureName': '我的书评', 'process': 'G1--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <apirun.extend.keywords.KeyWords object at 0x00000215ADF63370>
|
|
|
+kwargs = {'EXPECTED': '书籍ID不存在', 'OP_STR': '==', 'VALUE': 'SUCCESS', '关键字': 'assert_text_comparators'}
|
|
|
+comparators = {'!=': <function KeyWords.assert_text_comparators.<locals>.<lambda> at 0x00000215ADF42160>, '<': <function KeyWords.as...at 0x00000215ADF420D0>, '==': <function KeyWords.assert_text_comparators.<locals>.<lambda> at 0x00000215ADFCB280>, ...}
|
|
|
+message = None
|
|
|
+
|
|
|
+ @allure.step("参数数据:断言当前文本内容")
|
|
|
+ def assert_text_comparators(self, **kwargs):
|
|
|
+ """
|
|
|
+ 封装断言以进行不同的比较操作。
|
|
|
+
|
|
|
+ 参数:
|
|
|
+ value (Any): 要比较的值。
|
|
|
+ expected (Any): 预期的值。
|
|
|
+ op_str (str): 操作符的字符串表示(如 '>', '<', '==' 等)。
|
|
|
+ message (str, optional): 自定义的错误消息。
|
|
|
+
|
|
|
+ 返回:
|
|
|
+ None: 如果断言成功,则不返回任何内容。
|
|
|
+
|
|
|
+ 引发:
|
|
|
+ AssertionError: 如果断言失败。
|
|
|
+ """
|
|
|
+ comparators = {
|
|
|
+ '>': lambda a, b: a > b,
|
|
|
+ '<': lambda a, b: a < b,
|
|
|
+ '==': lambda a, b: a == b,
|
|
|
+ '>=': lambda a, b: a >= b,
|
|
|
+ '<=': lambda a, b: a <= b,
|
|
|
+ '!=': lambda a, b: a != b,
|
|
|
+ }
|
|
|
+
|
|
|
+ message = kwargs.get("MESSAGE", None)
|
|
|
+
|
|
|
+ if kwargs["OP_STR"] not in comparators:
|
|
|
+ raise ValueError(f"没有该操作方式: {kwargs['OP_STR']}")
|
|
|
+
|
|
|
+ if not comparators[kwargs['OP_STR']](kwargs['VALUE'], kwargs["EXPECTED"]):
|
|
|
+ if message:
|
|
|
+ raise AssertionError(message)
|
|
|
+ else:
|
|
|
+> raise AssertionError(f"{kwargs['VALUE']} {kwargs['OP_STR']} {kwargs['EXPECTED']} 失败")
|
|
|
+E AssertionError: SUCCESS == 书籍ID不存在 失败
|
|
|
+
|
|
|
+extend\keywords.py:228: AssertionError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:41 INFO 异常:<ExceptionInfo AssertionError('SUCCESS == 书籍ID不存在 失败') tblen=31> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:41 INFO 用例耗时:0.1314056000000008 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:41 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:41 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': 118, 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '已评价过该书籍!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '3001', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDAsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDA4MDd9.SD_JAbmSzzYUHTkOi-Z3eBNl7-3eLJ5-znJJUJgyrm0Bl-vi2HrowFGwpzuBuPZblEJ4XiOMIADyamEEf08QwQ'}, 'DATA': {'bookId': 118, 'commentContent': 'hami的接口自动化'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': '已评价过该书籍!', 'EXPECTED': '已评价过该书籍!', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '3001', 'EXPECTED': '3001', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO -------------------测试用例名称:我的书评-发布已评价的数据执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:41 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P7] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:41 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:41 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:41 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:41 INFO 用例耗时:0.09981740000000006 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:41 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:41 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'ham'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:41 INFO 测试用例名称:我的书评-发布不满五个字的书评(BUG),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:41 INFO -------------------测试用例名称:我的书评-发布不满五个字的书评(BUG)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:42 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P8] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:42 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:42 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215AD7ED3D0>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布不满五个字的书评(BUG)', 'desc': '我的书评-发布不满五个字的书评(BUG)', 'featureName': '我的书评', 'process': 'G1--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:42 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:42 INFO 用例耗时:0.22421609999999959 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:42 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:42 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhahamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamham'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '评价不能超过200字符!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:我的书评-发布超过200个字的书评,开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:42 INFO -------------------测试用例名称:我的书评-发布超过200个字的书评执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:42 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P9] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:42 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:42 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADD91130>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布超过200个字的书评', 'desc': '我的书评-发布超过200个字的书评', 'featureName': '我的书评', 'process': 'G1--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:42 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:42 INFO 用例耗时:0.21816670000000027 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:42 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:42 INFO -----------------开始执行测试用例:[{'发送Get请求': {'关键字': 'request_get', 'URL': '{{URL}}/book/listClickRank', 'PARAMS': None, 'HEADERS': None}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': None, 'VARNAME': 'msg_success'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤0:发送Get请求 - {'关键字': 'request_get', 'URL': 'http://120.25.127.201:18001//book/listClickRank', 'PARAMS': None, 'HEADERS': None} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': None, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤2:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:42 INFO -------------------测试用例名称:点击榜单能够显示对应的数据执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:42 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P10] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:42 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:42 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:42 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:42 INFO 用例耗时:0.12021320000000024 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:42 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:42 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hami的接口自动化'}}}, {'JSON断言-等于-响应MSG': {'关键字': 'assert_json_comparators', 'VALUE': '$..msg', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'JSON断言-等于-CODE': {'关键字': 'assert_json_comparators', 'VALUE': '$..code', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:我的书评-发布正常的书评(优化-直接Josn断言),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:42 INFO -------------------测试用例名称:我的书评-发布正常的书评(优化-直接Josn断言)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:42 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G1--P11] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:42 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:42 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADD912B0>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布正常的书评(优化-直接Josn断言)', 'desc': '我的书评-发布正常的书评(优化-直接Josn断言)', 'featureName': '我的书评', 'process': 'G1--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:42 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:42 INFO 用例耗时:0.2180433000000006 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:42 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:42 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '{{username}}', 'password': '{{password}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'通过JSONPATH提取数据-TOKEN': {'关键字': 'ex_jsonData', 'EXVALUE': '$..token', 'INDEX': None, 'VARNAME': 'token'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:能够正确登录用例,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '123456'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:能够正确登录用例,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:能够正确登录用例,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:能够正确登录用例,开始执行步骤3:通过JSONPATH提取数据-TOKEN - {'关键字': 'ex_jsonData', 'EXVALUE': '$..token', 'INDEX': None, 'VARNAME': 'token'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:能够正确登录用例,开始执行步骤4:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:能够正确登录用例,开始执行步骤5:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:42 INFO -------------------测试用例名称:能够正确登录用例执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:42 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P0] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:42 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:42 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:42 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:42 INFO 用例耗时:0.08833190000000002 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:42 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:42 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '1234562'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '手机号或密码错误!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '1004', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:42 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '1234562'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': '手机号或密码错误!', 'EXPECTED': '手机号或密码错误!', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '1004', 'EXPECTED': '1004', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO -------------------测试用例名称:登录失败-手机号或密码错误用例执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:43 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P1] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:43 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:43 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:43 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:43 INFO 用例耗时:0.08791390000000021 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:43 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:43 INFO -----------------开始执行测试用例:[{'发送Get请求': {'关键字': 'request_get', 'URL': '{{URL}}/user/userInfo', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..username', 'INDEX': 0, 'VARNAME': 'msg_username'}}, {'断言-等于-响应USERNAME': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_username}}', 'EXPECTED': '{{username}}', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:查看用户信息,开始执行步骤0:发送Get请求 - {'关键字': 'request_get', 'URL': 'http://120.25.127.201:18001//user/userInfo', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDIsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDI5MzJ9.GuTgz0vBHbVprp8aluVjtGeP5Ezeu2CCImLLPRYhH19N2xgzmvbGeDwDgZZ4Mme20rJnfkpZVpF8ThwY5gGslQ'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:查看用户信息,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:查看用户信息,开始执行步骤2:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:查看用户信息,开始执行步骤3:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..username', 'INDEX': 0, 'VARNAME': 'msg_username'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:查看用户信息,开始执行步骤4:断言-等于-响应USERNAME - {'关键字': 'assert_text_comparators', 'VALUE': '15096268001', 'EXPECTED': '15096268001', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO -------------------测试用例名称:查看用户信息执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:43 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P2] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:43 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:43 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:43 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:43 INFO 用例耗时:0.08571500000000043 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:43 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:43 INFO -----------------开始执行测试用例:[{'发送Post请求-上传图片': {'关键字': 'request_post_form_data', 'URL': '{{URL}}/file/picUpload', 'FILES': '{"file":open("./files/20240725223321.png","rb")}', 'PARAMS': None, 'HEADERS': None}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}, {'通过JSONPATH提取数据-图片路径': {'关键字': 'ex_jsonData', 'EXVALUE': '$..data', 'INDEX': 0, 'VARNAME': 'msg_data'}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:修改头像-上传头像,开始执行步骤0:发送Post请求-上传图片 - {'关键字': 'request_post_form_data', 'URL': 'http://120.25.127.201:18001//file/picUpload', 'FILES': '{"file":open("./files/20240725223321.png","rb")}', 'PARAMS': None, 'HEADERS': None} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:修改头像-上传头像,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:修改头像-上传头像,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:修改头像-上传头像,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:修改头像-上传头像,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:修改头像-上传头像,开始执行步骤5:通过JSONPATH提取数据-图片路径 - {'关键字': 'ex_jsonData', 'EXVALUE': '$..data', 'INDEX': 0, 'VARNAME': 'msg_data'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO -------------------测试用例名称:修改头像-上传头像执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:43 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P3] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:43 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:43 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:43 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:43 INFO 用例耗时:0.08649390000000068 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:43 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:43 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/updateUserInfo', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'userPhoto': '{{msg_data}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/updateUserInfo', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDIsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDI5MzJ9.GuTgz0vBHbVprp8aluVjtGeP5Ezeu2CCImLLPRYhH19N2xgzmvbGeDwDgZZ4Mme20rJnfkpZVpF8ThwY5gGslQ'}, 'DATA': {'userPhoto': '/localPic/2024/11/04/570f407f9a3e466caa6f146b4f9b8af4.png'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO -------------------测试用例名称:修改头像-确定修改头像执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:43 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P4] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:43 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:43 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:43 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:43 INFO 用例耗时:0.09365689999999915 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:43 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:43 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:我的书评-发布正常的书评(可能会失败),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO -------------------测试用例名称:我的书评-发布正常的书评(可能会失败)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:43 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P5] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:43 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:43 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADD91730>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布正常的书评(可能会失败)', 'desc': '我的书评-发布正常的书评(可能会失败)', 'featureName': '我的书评', 'process': 'G3--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:43 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:43 INFO 用例耗时:0.22499270000000138 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:43 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:43 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '', 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '书籍ID不存在', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDIsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDI5MzJ9.GuTgz0vBHbVprp8aluVjtGeP5Ezeu2CCImLLPRYhH19N2xgzmvbGeDwDgZZ4Mme20rJnfkpZVpF8ThwY5gGslQ'}, 'DATA': {'bookId': '', 'commentContent': 'hami的接口自动化'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': '书籍ID不存在', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO -------------------测试用例名称:我的书评-发布不存在的书籍ID(BUG)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:43 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P6] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:43 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:43 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADD917F0>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布不存在的书籍ID(BUG)', 'desc': '我的书评-发布不存在的书籍ID(BUG)', 'featureName': '我的书评', 'process': 'G3--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <apirun.extend.keywords.KeyWords object at 0x00000215AE0D9490>
|
|
|
+kwargs = {'EXPECTED': '书籍ID不存在', 'OP_STR': '==', 'VALUE': 'SUCCESS', '关键字': 'assert_text_comparators'}
|
|
|
+comparators = {'!=': <function KeyWords.assert_text_comparators.<locals>.<lambda> at 0x00000215ADF675E0>, '<': <function KeyWords.as...at 0x00000215ADF67550>, '==': <function KeyWords.assert_text_comparators.<locals>.<lambda> at 0x00000215ADF67430>, ...}
|
|
|
+message = None
|
|
|
+
|
|
|
+ @allure.step("参数数据:断言当前文本内容")
|
|
|
+ def assert_text_comparators(self, **kwargs):
|
|
|
+ """
|
|
|
+ 封装断言以进行不同的比较操作。
|
|
|
+
|
|
|
+ 参数:
|
|
|
+ value (Any): 要比较的值。
|
|
|
+ expected (Any): 预期的值。
|
|
|
+ op_str (str): 操作符的字符串表示(如 '>', '<', '==' 等)。
|
|
|
+ message (str, optional): 自定义的错误消息。
|
|
|
+
|
|
|
+ 返回:
|
|
|
+ None: 如果断言成功,则不返回任何内容。
|
|
|
+
|
|
|
+ 引发:
|
|
|
+ AssertionError: 如果断言失败。
|
|
|
+ """
|
|
|
+ comparators = {
|
|
|
+ '>': lambda a, b: a > b,
|
|
|
+ '<': lambda a, b: a < b,
|
|
|
+ '==': lambda a, b: a == b,
|
|
|
+ '>=': lambda a, b: a >= b,
|
|
|
+ '<=': lambda a, b: a <= b,
|
|
|
+ '!=': lambda a, b: a != b,
|
|
|
+ }
|
|
|
+
|
|
|
+ message = kwargs.get("MESSAGE", None)
|
|
|
+
|
|
|
+ if kwargs["OP_STR"] not in comparators:
|
|
|
+ raise ValueError(f"没有该操作方式: {kwargs['OP_STR']}")
|
|
|
+
|
|
|
+ if not comparators[kwargs['OP_STR']](kwargs['VALUE'], kwargs["EXPECTED"]):
|
|
|
+ if message:
|
|
|
+ raise AssertionError(message)
|
|
|
+ else:
|
|
|
+> raise AssertionError(f"{kwargs['VALUE']} {kwargs['OP_STR']} {kwargs['EXPECTED']} 失败")
|
|
|
+E AssertionError: SUCCESS == 书籍ID不存在 失败
|
|
|
+
|
|
|
+extend\keywords.py:228: AssertionError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:43 INFO 异常:<ExceptionInfo AssertionError('SUCCESS == 书籍ID不存在 失败') tblen=31> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:43 INFO 用例耗时:0.1124168000000001 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:43 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:43 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': 118, 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '已评价过该书籍!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '3001', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDIsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDI5MzJ9.GuTgz0vBHbVprp8aluVjtGeP5Ezeu2CCImLLPRYhH19N2xgzmvbGeDwDgZZ4Mme20rJnfkpZVpF8ThwY5gGslQ'}, 'DATA': {'bookId': 118, 'commentContent': 'hami的接口自动化'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': '已评价过该书籍!', 'EXPECTED': '已评价过该书籍!', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '3001', 'EXPECTED': '3001', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:43 INFO -------------------测试用例名称:我的书评-发布已评价的数据执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:43 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P7] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:43 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:43 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:43 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:43 INFO 用例耗时:0.09828979999999987 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:43 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:43 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'ham'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:43 INFO 测试用例名称:我的书评-发布不满五个字的书评(BUG),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:44 INFO -------------------测试用例名称:我的书评-发布不满五个字的书评(BUG)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:44 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P8] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:44 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:44 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADD91970>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布不满五个字的书评(BUG)', 'desc': '我的书评-发布不满五个字的书评(BUG)', 'featureName': '我的书评', 'process': 'G3--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:44 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:44 INFO 用例耗时:0.2153898999999999 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:44 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:44 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhahamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamham'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '评价不能超过200字符!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:44 INFO 测试用例名称:我的书评-发布超过200个字的书评,开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:44 INFO -------------------测试用例名称:我的书评-发布超过200个字的书评执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:44 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P9] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:44 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:44 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADD91A30>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布超过200个字的书评', 'desc': '我的书评-发布超过200个字的书评', 'featureName': '我的书评', 'process': 'G3--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:44 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:44 INFO 用例耗时:0.21632590000000107 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:44 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:44 INFO -----------------开始执行测试用例:[{'发送Get请求': {'关键字': 'request_get', 'URL': '{{URL}}/book/listClickRank', 'PARAMS': None, 'HEADERS': None}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': None, 'VARNAME': 'msg_success'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:44 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤0:发送Get请求 - {'关键字': 'request_get', 'URL': 'http://120.25.127.201:18001//book/listClickRank', 'PARAMS': None, 'HEADERS': None} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:44 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': None, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:44 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤2:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:44 INFO -------------------测试用例名称:点击榜单能够显示对应的数据执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:44 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P10] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:44 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:44 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:44 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:44 INFO 用例耗时:0.10466459999999955 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:44 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:44 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hami的接口自动化'}}}, {'JSON断言-等于-响应MSG': {'关键字': 'assert_json_comparators', 'VALUE': '$..msg', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'JSON断言-等于-CODE': {'关键字': 'assert_json_comparators', 'VALUE': '$..code', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:44 INFO 测试用例名称:我的书评-发布正常的书评(优化-直接Josn断言),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:44 INFO -------------------测试用例名称:我的书评-发布正常的书评(优化-直接Josn断言)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:44 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G3--P11] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:44 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:44 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADD91BB0>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布正常的书评(优化-直接Josn断言)', 'desc': '我的书评-发布正常的书评(优化-直接Josn断言)', 'featureName': '我的书评', 'process': 'G3--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:44 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:44 INFO 用例耗时:0.21585119999999947 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:44 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:44 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '{{username}}', 'password': '{{password}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'通过JSONPATH提取数据-TOKEN': {'关键字': 'ex_jsonData', 'EXVALUE': '$..token', 'INDEX': None, 'VARNAME': 'token'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:44 INFO 测试用例名称:能够正确登录用例,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '123456'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:能够正确登录用例,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:能够正确登录用例,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:能够正确登录用例,开始执行步骤3:通过JSONPATH提取数据-TOKEN - {'关键字': 'ex_jsonData', 'EXVALUE': '$..token', 'INDEX': None, 'VARNAME': 'token'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:能够正确登录用例,开始执行步骤4:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:能够正确登录用例,开始执行步骤5:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO -------------------测试用例名称:能够正确登录用例执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:45 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P0] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:45 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:45 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:45 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:45 INFO 用例耗时:0.08543449999999986 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:45 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:45 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '1234562'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '手机号或密码错误!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '1004', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/login', 'PARAMS': None, 'HEADERS': None, 'DATA': {'username': '15096268001', 'password': '1234562'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': '手机号或密码错误!', 'EXPECTED': '手机号或密码错误!', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:登录失败-手机号或密码错误用例,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '1004', 'EXPECTED': '1004', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO -------------------测试用例名称:登录失败-手机号或密码错误用例执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:45 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P1] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:45 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:45 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:45 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:45 INFO 用例耗时:0.09628380000000014 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:45 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:45 INFO -----------------开始执行测试用例:[{'发送Get请求': {'关键字': 'request_get', 'URL': '{{URL}}/user/userInfo', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..username', 'INDEX': 0, 'VARNAME': 'msg_username'}}, {'断言-等于-响应USERNAME': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_username}}', 'EXPECTED': '{{username}}', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:查看用户信息,开始执行步骤0:发送Get请求 - {'关键字': 'request_get', 'URL': 'http://120.25.127.201:18001//user/userInfo', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDUsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDUwMDh9.p8c93ppTDwsZlGT4rDNGu0okJNH4eq0hioc7SgqQ3XxvUHzIINMm6L6eRqFxjY_Bbi0EP4KMSBgDFZUKiDNF5A'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:查看用户信息,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:查看用户信息,开始执行步骤2:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:查看用户信息,开始执行步骤3:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..username', 'INDEX': 0, 'VARNAME': 'msg_username'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:查看用户信息,开始执行步骤4:断言-等于-响应USERNAME - {'关键字': 'assert_text_comparators', 'VALUE': '15096268001', 'EXPECTED': '15096268001', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO -------------------测试用例名称:查看用户信息执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:45 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P2] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:45 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:45 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:45 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:45 INFO 用例耗时:0.08434860000000022 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:45 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:45 INFO -----------------开始执行测试用例:[{'发送Post请求-上传图片': {'关键字': 'request_post_form_data', 'URL': '{{URL}}/file/picUpload', 'FILES': '{"file":open("./files/20240725223321.png","rb")}', 'PARAMS': None, 'HEADERS': None}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}, {'通过JSONPATH提取数据-图片路径': {'关键字': 'ex_jsonData', 'EXVALUE': '$..data', 'INDEX': 0, 'VARNAME': 'msg_data'}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:修改头像-上传头像,开始执行步骤0:发送Post请求-上传图片 - {'关键字': 'request_post_form_data', 'URL': 'http://120.25.127.201:18001//file/picUpload', 'FILES': '{"file":open("./files/20240725223321.png","rb")}', 'PARAMS': None, 'HEADERS': None} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:修改头像-上传头像,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:修改头像-上传头像,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:修改头像-上传头像,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:修改头像-上传头像,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:修改头像-上传头像,开始执行步骤5:通过JSONPATH提取数据-图片路径 - {'关键字': 'ex_jsonData', 'EXVALUE': '$..data', 'INDEX': 0, 'VARNAME': 'msg_data'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO -------------------测试用例名称:修改头像-上传头像执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:45 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P3] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:45 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:45 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:45 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:45 INFO 用例耗时:0.08542759999999916 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:45 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:45 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/user/updateUserInfo', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'userPhoto': '{{msg_data}}'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//user/updateUserInfo', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDUsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDUwMDh9.p8c93ppTDwsZlGT4rDNGu0okJNH4eq0hioc7SgqQ3XxvUHzIINMm6L6eRqFxjY_Bbi0EP4KMSBgDFZUKiDNF5A'}, 'DATA': {'userPhoto': '/localPic/2024/11/04/23464fa16c494ce7a9e26777e98ccf00.png'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:修改头像-确定修改头像,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '200', 'EXPECTED': '200', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO -------------------测试用例名称:修改头像-确定修改头像执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:45 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P4] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:45 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:45 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:45 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:45 INFO 用例耗时:0.09263550000000009 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:45 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:45 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:我的书评-发布正常的书评(可能会失败),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO -------------------测试用例名称:我的书评-发布正常的书评(可能会失败)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:45 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P5] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:45 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:45 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADD91FD0>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布正常的书评(可能会失败)', 'desc': '我的书评-发布正常的书评(可能会失败)', 'featureName': '我的书评', 'process': 'G2--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:45 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:45 INFO 用例耗时:0.21499640000000042 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:45 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:45 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '', 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '书籍ID不存在', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDUsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDUwMDh9.p8c93ppTDwsZlGT4rDNGu0okJNH4eq0hioc7SgqQ3XxvUHzIINMm6L6eRqFxjY_Bbi0EP4KMSBgDFZUKiDNF5A'}, 'DATA': {'bookId': '', 'commentContent': 'hami的接口自动化'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:我的书评-发布不存在的书籍ID(BUG),开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': '书籍ID不存在', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO -------------------测试用例名称:我的书评-发布不存在的书籍ID(BUG)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:45 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P6] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:45 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:45 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADC8DFA0>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布不存在的书籍ID(BUG)', 'desc': '我的书评-发布不存在的书籍ID(BUG)', 'featureName': '我的书评', 'process': 'G2--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <apirun.extend.keywords.KeyWords object at 0x00000215ADFEA310>
|
|
|
+kwargs = {'EXPECTED': '书籍ID不存在', 'OP_STR': '==', 'VALUE': 'SUCCESS', '关键字': 'assert_text_comparators'}
|
|
|
+comparators = {'!=': <function KeyWords.assert_text_comparators.<locals>.<lambda> at 0x00000215AE0B3430>, '<': <function KeyWords.as...at 0x00000215AE0B33A0>, '==': <function KeyWords.assert_text_comparators.<locals>.<lambda> at 0x00000215AE0B3700>, ...}
|
|
|
+message = None
|
|
|
+
|
|
|
+ @allure.step("参数数据:断言当前文本内容")
|
|
|
+ def assert_text_comparators(self, **kwargs):
|
|
|
+ """
|
|
|
+ 封装断言以进行不同的比较操作。
|
|
|
+
|
|
|
+ 参数:
|
|
|
+ value (Any): 要比较的值。
|
|
|
+ expected (Any): 预期的值。
|
|
|
+ op_str (str): 操作符的字符串表示(如 '>', '<', '==' 等)。
|
|
|
+ message (str, optional): 自定义的错误消息。
|
|
|
+
|
|
|
+ 返回:
|
|
|
+ None: 如果断言成功,则不返回任何内容。
|
|
|
+
|
|
|
+ 引发:
|
|
|
+ AssertionError: 如果断言失败。
|
|
|
+ """
|
|
|
+ comparators = {
|
|
|
+ '>': lambda a, b: a > b,
|
|
|
+ '<': lambda a, b: a < b,
|
|
|
+ '==': lambda a, b: a == b,
|
|
|
+ '>=': lambda a, b: a >= b,
|
|
|
+ '<=': lambda a, b: a <= b,
|
|
|
+ '!=': lambda a, b: a != b,
|
|
|
+ }
|
|
|
+
|
|
|
+ message = kwargs.get("MESSAGE", None)
|
|
|
+
|
|
|
+ if kwargs["OP_STR"] not in comparators:
|
|
|
+ raise ValueError(f"没有该操作方式: {kwargs['OP_STR']}")
|
|
|
+
|
|
|
+ if not comparators[kwargs['OP_STR']](kwargs['VALUE'], kwargs["EXPECTED"]):
|
|
|
+ if message:
|
|
|
+ raise AssertionError(message)
|
|
|
+ else:
|
|
|
+> raise AssertionError(f"{kwargs['VALUE']} {kwargs['OP_STR']} {kwargs['EXPECTED']} 失败")
|
|
|
+E AssertionError: SUCCESS == 书籍ID不存在 失败
|
|
|
+
|
|
|
+extend\keywords.py:228: AssertionError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:45 INFO 异常:<ExceptionInfo AssertionError('SUCCESS == 书籍ID不存在 失败') tblen=31> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:45 INFO 用例耗时:0.11337829999999904 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:45 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:45 INFO -----------------开始执行测试用例:[{'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': 118, 'commentContent': 'hami的接口自动化'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '已评价过该书籍!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '3001', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤0:发送Post请求 - {'关键字': 'request_post_form_urlencoded', 'URL': 'http://120.25.127.201:18001//book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3MzEzMjc5NDUsInN1YiI6IntcImlkXCI6MTc5MTA1NjM4NjYzOTg3MjAwMCxcInVzZXJuYW1lXCI6XCIxNTA5NjI2ODAwMVwiLFwibmlja05hbWVcIjpcIuS4gOS6jOS4iVwifSIsImNyZWF0ZWQiOjE3MzA3MjMxNDUwMDh9.p8c93ppTDwsZlGT4rDNGu0okJNH4eq0hioc7SgqQ3XxvUHzIINMm6L6eRqFxjY_Bbi0EP4KMSBgDFZUKiDNF5A'}, 'DATA': {'bookId': 118, 'commentContent': 'hami的接口自动化'}} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤2:通过JSONPATH提取数据-Code - {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤3:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': '已评价过该书籍!', 'EXPECTED': '已评价过该书籍!', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:我的书评-发布已评价的数据,开始执行步骤4:断言-等于-CODE - {'关键字': 'assert_text_comparators', 'VALUE': '3001', 'EXPECTED': '3001', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:45 INFO -------------------测试用例名称:我的书评-发布已评价的数据执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:45 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P7] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:45 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:45 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:45 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:45 INFO 用例耗时:0.09990250000000067 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:45 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:45 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'ham'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:45 INFO 测试用例名称:我的书评-发布不满五个字的书评(BUG),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:46 INFO -------------------测试用例名称:我的书评-发布不满五个字的书评(BUG)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:46 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P8] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:46 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:46 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADC4B100>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布不满五个字的书评(BUG)', 'desc': '我的书评-发布不满五个字的书评(BUG)', 'featureName': '我的书评', 'process': 'G2--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:46 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:46 INFO 用例耗时:0.1959156999999987 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:46 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:46 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhahamhamhamhamhamhamhamhamhamhamhamhamhamhamhamhamham'}}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': 0, 'VARNAME': 'msg_success'}}, {'通过JSONPATH提取数据-Code': {'关键字': 'ex_jsonData', 'EXVALUE': '$..code', 'INDEX': 0, 'VARNAME': 'msg_code'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': '评价不能超过200字符!', 'OP_STR': '=='}}, {'断言-等于-CODE': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_code}}', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:46 INFO 测试用例名称:我的书评-发布超过200个字的书评,开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:46 INFO -------------------测试用例名称:我的书评-发布超过200个字的书评执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:46 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P9] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:46 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:46 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADCB21F0>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布超过200个字的书评', 'desc': '我的书评-发布超过200个字的书评', 'featureName': '我的书评', 'process': 'G2--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:46 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:46 INFO 用例耗时:0.20920360000000038 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:46 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:46 INFO -----------------开始执行测试用例:[{'发送Get请求': {'关键字': 'request_get', 'URL': '{{URL}}/book/listClickRank', 'PARAMS': None, 'HEADERS': None}}, {'通过JSONPATH提取数据-MSG': {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': None, 'VARNAME': 'msg_success'}}, {'断言-等于-响应MSG': {'关键字': 'assert_text_comparators', 'VALUE': '{{msg_success}}', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:46 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤0:发送Get请求 - {'关键字': 'request_get', 'URL': 'http://120.25.127.201:18001//book/listClickRank', 'PARAMS': None, 'HEADERS': None} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:46 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤1:通过JSONPATH提取数据-MSG - {'关键字': 'ex_jsonData', 'EXVALUE': '$..msg', 'INDEX': None, 'VARNAME': 'msg_success'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:46 INFO 测试用例名称:点击榜单能够显示对应的数据,开始执行步骤2:断言-等于-响应MSG - {'关键字': 'assert_text_comparators', 'VALUE': 'SUCCESS', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:46 INFO -------------------测试用例名称:点击榜单能够显示对应的数据执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:46 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P10] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:46 INFO 测试结果:passed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:46 INFO 故障表示:None conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:46 INFO 异常:None conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:46 INFO 用例耗时:0.11341100000000104 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:46 INFO ************************************** conftest.py pytest_runtest_makereport 73
|
|
|
+2024-11-04 20:25:46 INFO -----------------开始执行测试用例:[{'提取评价的书籍ID': {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'}}, {'发送Post请求': {'关键字': 'request_post_form_urlencoded', 'URL': '{{URL}}/book/addBookComment', 'PARAMS': None, 'HEADERS': {'Authorization': '{{token}}'}, 'DATA': {'bookId': '{{id_1}}', 'commentContent': 'hami的接口自动化'}}}, {'JSON断言-等于-响应MSG': {'关键字': 'assert_json_comparators', 'VALUE': '$..msg', 'EXPECTED': 'SUCCESS', 'OP_STR': '=='}}, {'JSON断言-等于-CODE': {'关键字': 'assert_json_comparators', 'VALUE': '$..code', 'EXPECTED': '200', 'OP_STR': '=='}}]------------- ApiTestRunner.py test_case_execute 33
|
|
|
+2024-11-04 20:25:46 INFO 测试用例名称:我的书评-发布正常的书评(优化-直接Josn断言),开始执行步骤0:提取评价的书籍ID - {'关键字': 'ex_mysqlData', '数据库': 'dsw_mysql', 'SQL': 'SELECT id FROM `book` ORDER BY RAND() LIMIT 1', '引用变量': 'id'} ApiTestRunner.py test_case_execute 42
|
|
|
+2024-11-04 20:25:46 INFO -------------------测试用例名称:我的书评-发布正常的书评(优化-直接Josn断言)执行结束---------------------- ApiTestRunner.py test_case_execute 53
|
|
|
+2024-11-04 20:25:47 INFO 用例ID:core/ApiTestRunner.py::TestRunner::test_case_execute[G2--P11] conftest.py pytest_runtest_makereport 68
|
|
|
+2024-11-04 20:25:47 INFO 测试结果:failed conftest.py pytest_runtest_makereport 69
|
|
|
+2024-11-04 20:25:47 INFO 故障表示:self = <apirun.core.ApiTestRunner.TestRunner object at 0x00000215ADCB22E0>
|
|
|
+caseinfo = {'_case_name': '我的书评-发布正常的书评(优化-直接Josn断言)', 'desc': '我的书评-发布正常的书评(优化-直接Josn断言)', 'featureName': '我的书评', 'process': 'G2--P', ...}
|
|
|
+
|
|
|
+ def test_case_execute(self, caseinfo):
|
|
|
+ casename = caseinfo["_case_name"]
|
|
|
+ # TODO 2-1 : 调用动态生成标题的方法
|
|
|
+ dynamicTitle(caseinfo)
|
|
|
+
|
|
|
+ # TODO 2-2: 基于我们步骤一步步进行执行
|
|
|
+ try:
|
|
|
+ # 实例化关键字对象
|
|
|
+ keywords = KeyWords()
|
|
|
+
|
|
|
+ # 获取当前用例变量,方便后续的渲染
|
|
|
+ local_context = caseinfo.get("context",{})
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+
|
|
|
+ steps = caseinfo.get("steps", None)
|
|
|
+ logger.info(f"-----------------开始执行测试用例:{steps}-------------")
|
|
|
+ for index,step in enumerate(steps):
|
|
|
+ # 提示信息
|
|
|
+ step_name = list(step.keys())[0]
|
|
|
+ step_value = list(step.values())[0]
|
|
|
+ # TODO : 每一个步骤进行变量的渲染
|
|
|
+ context = copy.deepcopy(g_context().show_dict())
|
|
|
+ context.update(local_context)
|
|
|
+ step_value = eval(refresh(step_value, context))
|
|
|
+ logger.info(f"测试用例名称:{casename},开始执行步骤{index}:{step_name} - {step_value}")
|
|
|
+ # 基于每个步骤的关键字,找到对应的方法,然后把参数给它
|
|
|
+ # 通过【反射】的方式去找到对应的方法
|
|
|
+ with allure.step(step_name):
|
|
|
+ key = step_value["关键字"] # 具体的方法名, 在 keywords 里面找到这个方法
|
|
|
+ try:
|
|
|
+ key_func = keywords.__getattribute__(key) # 从keywords获取到对应方法
|
|
|
+ except AttributeError as e:
|
|
|
+ logger.error(f"测试用例名称:{casename},没有这个关键字方法", e)
|
|
|
+> key_func(**step_value) # 调用方法
|
|
|
+
|
|
|
+core\ApiTestRunner.py:51:
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+extend\keywords.py:183: in ex_mysqlData
|
|
|
+ logger.info("数据库查询结果:", rs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1446: in info
|
|
|
+ self._log(INFO, msg, args, **kwargs)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1589: in _log
|
|
|
+ self.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1599: in handle
|
|
|
+ self.callHandlers(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1661: in callHandlers
|
|
|
+ hdlr.handle(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:952: in handle
|
|
|
+ self.emit(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:380: in emit
|
|
|
+ super().emit(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1091: in emit
|
|
|
+ self.handleError(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:1083: in emit
|
|
|
+ msg = self.format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:927: in format
|
|
|
+ return fmt.format(record)
|
|
|
+..\myenv\lib\site-packages\_pytest\logging.py:140: in format
|
|
|
+ return super().format(record)
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:663: in format
|
|
|
+ record.message = record.getMessage()
|
|
|
+_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
+
|
|
|
+self = <LogRecord: testlog, 20, D:\001_zzh\eng\api-engine\apirun\extend\keywords.py, 183, "数据库查询结果:">
|
|
|
+
|
|
|
+ def getMessage(self):
|
|
|
+ """
|
|
|
+ Return the message for this LogRecord.
|
|
|
+
|
|
|
+ Return the message for this LogRecord after merging any user-supplied
|
|
|
+ arguments with the message.
|
|
|
+ """
|
|
|
+ msg = str(self.msg)
|
|
|
+ if self.args:
|
|
|
+> msg = msg % self.args
|
|
|
+E TypeError: not all arguments converted during string formatting
|
|
|
+
|
|
|
+C:\Users\zhuzhenghui\AppData\Local\Programs\Python\Python39\lib\logging\__init__.py:367: TypeError conftest.py pytest_runtest_makereport 70
|
|
|
+2024-11-04 20:25:47 INFO 异常:<ExceptionInfo TypeError('not all arguments converted during string formatting') tblen=43> conftest.py pytest_runtest_makereport 71
|
|
|
+2024-11-04 20:25:47 INFO 用例耗时:0.22291740000000004 conftest.py pytest_runtest_makereport 72
|
|
|
+2024-11-04 20:25:47 INFO ************************************** conftest.py pytest_runtest_makereport 73
|