优化测试脚本。

This commit is contained in:
aaronchenyongzhi 2023-06-25 22:51:51 +08:00
parent a103509ef2
commit 0d3ae34578
7 changed files with 42 additions and 268 deletions

View File

@ -1 +1,2 @@
2023-06-25 22:14:00 | ERROR | 被提取对象非字典、非字符串、非列表不执行jsonpath提取被提取对象: None
2023-06-25 22:45:38 | ERROR | 被提取对象非字典、非字符串、非列表不执行jsonpath提取被提取对象: None

Binary file not shown.

View File

@ -19,4 +19,4 @@ from common.validation.validator import Validator
class Action(Extractor, LoadScript, Validator):
def __init__(self):
super().__init__()
self.encrypt_data = EncryptData()
self.encrypt = EncryptData()

View File

@ -3,7 +3,7 @@
"""
@author: kira
@contact: 262667641@qq.com
@file: encrypt_data.py
@file: encrypt.py
@time: 2023/6/16 15:43
@desc:
"""
@ -14,7 +14,7 @@ from extensions import sign
@logger.log_decorator()
class EncryptData:
def encrypt_data(self, headers_crypto, headers, request_data_crypto, request_data):
def encrypts(self, headers_crypto, headers, request_data_crypto, request_data):
encryption_methods = {
"MD5": sign.md5_sign,
"sha1": sign.sha1_sign,

View File

@ -1,232 +1 @@
[
{
"success": 4,
"all": 7,
"fail": 1,
"skip": 0,
"error": 2,
"runtime": "0.45 S",
"begin_time": "2023-04-21 12:10:31",
"pass_rate": "57.14"
},
{
"success": 0,
"all": 1,
"fail": 0,
"skip": 0,
"error": 1,
"runtime": "0.01 S",
"begin_time": "2023-04-21 12:11:52",
"pass_rate": "0.00"
},
{
"success": 5,
"all": 6,
"fail": 1,
"skip": 0,
"error": 0,
"runtime": "0.33 S",
"begin_time": "2023-04-21 12:12:54",
"pass_rate": "83.33"
},
{
"success": 5,
"all": 6,
"fail": 1,
"skip": 0,
"error": 0,
"runtime": "0.30 S",
"begin_time": "2023-04-21 12:13:32",
"pass_rate": "83.33"
},
{
"success": 5,
"all": 6,
"fail": 1,
"skip": 0,
"error": 0,
"runtime": "0.28 S",
"begin_time": "2023-04-21 14:47:43",
"pass_rate": "83.33"
},
{
"success": 5,
"all": 6,
"fail": 1,
"skip": 0,
"error": 0,
"runtime": "0.27 S",
"begin_time": "2023-04-21 15:01:06",
"pass_rate": "83.33"
},
{
"success": 5,
"all": 6,
"fail": 1,
"skip": 0,
"error": 0,
"runtime": "0.24 S",
"begin_time": "2023-04-21 15:03:53",
"pass_rate": "83.33"
},
{
"success": 5,
"all": 6,
"fail": 1,
"skip": 0,
"error": 0,
"runtime": "0.23 S",
"begin_time": "2023-04-21 15:06:10",
"pass_rate": "83.33"
},
{
"success": 6,
"all": 7,
"fail": 0,
"skip": 0,
"error": 1,
"runtime": "3.00 S",
"begin_time": "2023-05-14 23:58:13",
"pass_rate": "85.71"
},
{
"success": 0,
"all": 2,
"fail": 0,
"skip": 0,
"error": 2,
"runtime": "0.02 S",
"begin_time": "2023-05-15 11:52:27",
"pass_rate": "0.00"
},
{
"success": 0,
"all": 2,
"fail": 0,
"skip": 0,
"error": 2,
"runtime": "0.00 S",
"begin_time": "2023-05-15 11:57:23",
"pass_rate": "0.00"
},
{
"success": 6,
"all": 7,
"fail": 0,
"skip": 0,
"error": 1,
"runtime": "1.38 S",
"begin_time": "2023-05-15 11:59:30",
"pass_rate": "85.71"
},
{
"success": 6,
"all": 7,
"fail": 0,
"skip": 0,
"error": 1,
"runtime": "1.44 S",
"begin_time": "2023-05-16 15:11:50",
"pass_rate": "85.71"
},
{
"success": 6,
"all": 7,
"fail": 0,
"skip": 0,
"error": 1,
"runtime": "1.28 S",
"begin_time": "2023-05-17 17:12:52",
"pass_rate": "85.71"
},
{
"success": 0,
"all": 1,
"fail": 0,
"skip": 0,
"error": 1,
"runtime": "0.00 S",
"begin_time": "2023-05-17 17:17:15",
"pass_rate": "0.00"
},
{
"success": 6,
"all": 6,
"fail": 0,
"skip": 0,
"error": 0,
"runtime": "1.33 S",
"begin_time": "2023-05-17 17:21:07",
"pass_rate": "100.00"
},
{
"success": 0,
"all": 1,
"fail": 0,
"skip": 0,
"error": 1,
"runtime": "0.00 S",
"begin_time": "2023-06-14 15:16:14",
"pass_rate": "0.00"
},
{
"success": 82,
"all": 82,
"fail": 0,
"skip": 0,
"error": 0,
"runtime": "6.38 S",
"begin_time": "2023-06-16 16:22:27",
"pass_rate": "100.00"
},
{
"success": 6,
"all": 6,
"fail": 0,
"skip": 0,
"error": 0,
"runtime": "6.32 S",
"begin_time": "2023-06-16 16:26:52",
"pass_rate": "100.00"
},
{
"success": 6,
"all": 6,
"fail": 0,
"skip": 0,
"error": 0,
"runtime": "6.35 S",
"begin_time": "2023-06-16 16:30:50",
"pass_rate": "100.00"
},
{
"success": 6,
"all": 6,
"fail": 0,
"skip": 0,
"error": 0,
"runtime": "6.33 S",
"begin_time": "2023-06-16 16:32:32",
"pass_rate": "100.00"
},
{
"success": 6,
"all": 6,
"fail": 0,
"skip": 0,
"error": 0,
"runtime": "6.32 S",
"begin_time": "2023-06-16 16:36:00",
"pass_rate": "100.00"
},
{
"success": 6,
"all": 6,
"fail": 0,
"skip": 0,
"error": 0,
"runtime": "6.60 S",
"begin_time": "2023-06-25 22:13:53",
"pass_rate": "100.00"
}
]
[{"success": 4, "all": 7, "fail": 1, "skip": 0, "error": 2, "runtime": "0.45 S", "begin_time": "2023-04-21 12:10:31", "pass_rate": "57.14"}, {"success": 0, "all": 1, "fail": 0, "skip": 0, "error": 1, "runtime": "0.01 S", "begin_time": "2023-04-21 12:11:52", "pass_rate": "0.00"}, {"success": 5, "all": 6, "fail": 1, "skip": 0, "error": 0, "runtime": "0.33 S", "begin_time": "2023-04-21 12:12:54", "pass_rate": "83.33"}, {"success": 5, "all": 6, "fail": 1, "skip": 0, "error": 0, "runtime": "0.30 S", "begin_time": "2023-04-21 12:13:32", "pass_rate": "83.33"}, {"success": 5, "all": 6, "fail": 1, "skip": 0, "error": 0, "runtime": "0.28 S", "begin_time": "2023-04-21 14:47:43", "pass_rate": "83.33"}, {"success": 5, "all": 6, "fail": 1, "skip": 0, "error": 0, "runtime": "0.27 S", "begin_time": "2023-04-21 15:01:06", "pass_rate": "83.33"}, {"success": 5, "all": 6, "fail": 1, "skip": 0, "error": 0, "runtime": "0.24 S", "begin_time": "2023-04-21 15:03:53", "pass_rate": "83.33"}, {"success": 5, "all": 6, "fail": 1, "skip": 0, "error": 0, "runtime": "0.23 S", "begin_time": "2023-04-21 15:06:10", "pass_rate": "83.33"}, {"success": 6, "all": 7, "fail": 0, "skip": 0, "error": 1, "runtime": "3.00 S", "begin_time": "2023-05-14 23:58:13", "pass_rate": "85.71"}, {"success": 0, "all": 2, "fail": 0, "skip": 0, "error": 2, "runtime": "0.02 S", "begin_time": "2023-05-15 11:52:27", "pass_rate": "0.00"}, {"success": 0, "all": 2, "fail": 0, "skip": 0, "error": 2, "runtime": "0.00 S", "begin_time": "2023-05-15 11:57:23", "pass_rate": "0.00"}, {"success": 6, "all": 7, "fail": 0, "skip": 0, "error": 1, "runtime": "1.38 S", "begin_time": "2023-05-15 11:59:30", "pass_rate": "85.71"}, {"success": 6, "all": 7, "fail": 0, "skip": 0, "error": 1, "runtime": "1.44 S", "begin_time": "2023-05-16 15:11:50", "pass_rate": "85.71"}, {"success": 6, "all": 7, "fail": 0, "skip": 0, "error": 1, "runtime": "1.28 S", "begin_time": "2023-05-17 17:12:52", "pass_rate": "85.71"}, {"success": 0, "all": 1, "fail": 0, "skip": 0, "error": 1, "runtime": "0.00 S", "begin_time": "2023-05-17 17:17:15", "pass_rate": "0.00"}, {"success": 6, "all": 6, "fail": 0, "skip": 0, "error": 0, "runtime": "1.33 S", "begin_time": "2023-05-17 17:21:07", "pass_rate": "100.00"}, {"success": 0, "all": 1, "fail": 0, "skip": 0, "error": 1, "runtime": "0.00 S", "begin_time": "2023-06-14 15:16:14", "pass_rate": "0.00"}, {"success": 82, "all": 82, "fail": 0, "skip": 0, "error": 0, "runtime": "6.38 S", "begin_time": "2023-06-16 16:22:27", "pass_rate": "100.00"}, {"success": 6, "all": 6, "fail": 0, "skip": 0, "error": 0, "runtime": "6.32 S", "begin_time": "2023-06-16 16:26:52", "pass_rate": "100.00"}, {"success": 6, "all": 6, "fail": 0, "skip": 0, "error": 0, "runtime": "6.35 S", "begin_time": "2023-06-16 16:30:50", "pass_rate": "100.00"}, {"success": 6, "all": 6, "fail": 0, "skip": 0, "error": 0, "runtime": "6.33 S", "begin_time": "2023-06-16 16:32:32", "pass_rate": "100.00"}, {"success": 6, "all": 6, "fail": 0, "skip": 0, "error": 0, "runtime": "6.32 S", "begin_time": "2023-06-16 16:36:00", "pass_rate": "100.00"}, {"success": 6, "all": 6, "fail": 0, "skip": 0, "error": 0, "runtime": "6.60 S", "begin_time": "2023-06-25 22:13:53", "pass_rate": "100.00"}, {"success": 6, "all": 6, "fail": 0, "skip": 0, "error": 0, "runtime": "6.65 S", "begin_time": "2023-06-25 22:45:32", "pass_rate": "100.00"}]

View File

@ -223,7 +223,7 @@
<div class="info">
<div style="flex:5">
<button type="button" class="btn btn-primary btn-sm">开始时间</button>
<span>2023-06-25 22:13:53</span>
<span>2023-06-25 22:45:32</span>
</div>
<div style="flex:5">
<button type="button" class="btn btn-primary btn-sm">用例总数</button>
@ -233,7 +233,7 @@
<div class="info">
<div style="flex:5">
<button type="button" class="btn btn-primary btn-sm">运行时长</button>
<span>6.60 S</span>
<span>6.65 S</span>
</div>
<div style="flex:5">
<button type="button" class="btn btn-primary btn-sm ">测试人员</button>
@ -272,6 +272,13 @@
</thead>
<tbody>
<tr>
<th scope="row">2023-06-25 22:45:32</th>
<td>6</td>
<td>6</td>
<td>100.00%</td>
</tr>
<tr>
<th scope="row">2023-06-25 22:13:53</th>
<td>6</td>
@ -511,7 +518,7 @@
<td class="TestProjectApi">TestProjectApi</td>
<td>test_api_2</td>
<td>None</td>
<td>1.29s</td>
<td>1.32s</td>
<td class="text-success">成功</td>
@ -530,8 +537,8 @@
请求头 --> {'Content-Type': 'application/json', 'Content-Length': '214'}
请求 body --> b'{"account": "18127813600", "password": "WD6Y0+LJLHXuFaplzUtSCnwktA7KgXCpjCS+OVvIFGTEoz2gbqK2oOOuJUf7ao0m2YYGiGi1pQTMBnkrxIY1cztGYbVp97kvIQwZLN4UhrOAe3h1asY/NLnDwB/byl7agcGv9WI4oy6B1Z93HVHmQiAKn7QqnDgPVITu4jthNc8="}'
接口状态--> 200
接口耗时--> 0:00:00.101005
接口响应--> {"code":"0","type":"success","data":{"id":"216877024344524552","userId":"216483504447804297","ibsUserId":7884,"mobile":"18127813600","bspToken":"3989b7356e0b17173f793d252a89a8b2","type":"user","avatar":null,"ncAccount":null,"timestamp":1687702434,"idpTokenId":null,"loginChannel":null,"clientType":null,"name":"陈勇志","btpToken":null,"account":"18127813600","accountType":"C","currentEnvId":null,"currentTenantId":"216260762345772077","currentAppId":"8d1f5bdc9c6648af84a98e2c017846c5","currentProjectId":"103654","currentOrgId":null,"currentMenuId":null,"currentOrgMenuId":null,"currentSelectedTab":"org","currentUrl":"/ibs/material/materialsReturned","tenants":[{"id":"1623811301356297657","code":"1623811301356297657","fullName":"广东博嘉拓建筑测试租户","shortName":"广东博嘉拓建筑测试租户","envId":"6296f5e3960c4fdfb9c9357b581c853b","envName":"默认环境","tenantEnvs":null},{"id":"216572673247394736","code":"9C8D5715AAA44D4B8530AB2B7F627E1A","fullName":"安徽腾越建筑工程有限公司","shortName":"安徽腾越建筑工程有限公司","envId":"d1b4f959495f433fb1dd5400a78bce2c","envName":"默认环境","tenantEnvs":null},{"id":"216317749963825419","code":"C2C35D2543B34CA99366D9C76E45D01B","fullName":"沈阳腾越建筑测试租户","shortName":"沈阳腾越建筑测试租户","envId":"c4a70c0a1f5c4aaa83fcd390dcd898c6","envName":"默认环境","tenantEnvs":null},{"id":"216260762345772077","code":"216260762345772077","fullName":"广东腾越建筑工程有限公司","shortName":"广东腾越建筑工程有限公司","envId":"210712034943271000","envName":"默认环境","tenantEnvs":null},{"id":"216328986981406025","code":"TENANT_TEST","fullName":"智慧工地测试租户9","shortName":"智慧工地测试租户9","envId":"e7682a3876a343b483645b0c20da93a3","envName":"默认环境","tenantEnvs":null},{"id":"216365124588606373","code":"TENANT_TEST","fullName":"计划排程自动化测试","shortName":"计划排程自动化测试","envId":"80ce8eb5a7c941f8a6f57b8ecb61ec17","envName":"默认环境","tenantEnvs":null},{"id":"216674624791091228","code":"232E9186B1BE494E966F27BA7CF33AE2","fullName":"cyq测试","shortName":"cyq测试","envId":"ef3f8ed4792f4ef0a5e7d92af394d29c","envName":"默认环境","tenantEnvs":null},{"id":"216687529947792866","code":"9769454E01304245AEE83CE7E99537A8","fullName":"成本总控报表测试租户","shortName":"成本总控报表测试租户","envId":"5125917072884123bf9fe3966ffa4af2","envName":"默认环境","tenantEnvs":null},{"id":"216661417159402453","code":"216661417159402453","fullName":"科技建筑集团","shortName":"科技建筑集团","envId":"b23d88da977e467cb81dd7fb57de97d0","envName":"默认环境","tenantEnvs":null},{"id":"216281557054332425","code":"216281557054332425","fullName":"BIM材料用量计算","shortName":"BIM材料用量计算","envId":"7501c77b0ccd4b4d912451e5f74c1ba7","envName":"默认环境","tenantEnvs":null},{"id":"1320970534539886592","code":"1320970534539886592","fullName":"碧桂园集团","shortName":"碧桂园集团","envId":"1320970534539886592","envName":"默认环境","tenantEnvs":null}],"loginAppDto":null},"msg":null,"succeed":true}
接口耗时--> 0:00:00.121070
接口响应--> {"code":"0","type":"success","data":{"id":"216877043329145631","userId":"216483504447804297","ibsUserId":7884,"mobile":"18127813600","bspToken":"ef624f367b662e55017d1c19e7e99171","type":"user","avatar":null,"ncAccount":null,"timestamp":1687704332,"idpTokenId":null,"loginChannel":null,"clientType":null,"name":"陈勇志","btpToken":null,"account":"18127813600","accountType":"C","currentEnvId":null,"currentTenantId":"216260762345772077","currentAppId":"8d1f5bdc9c6648af84a98e2c017846c5","currentProjectId":"103654","currentOrgId":null,"currentMenuId":null,"currentOrgMenuId":null,"currentSelectedTab":"org","currentUrl":"/ibs/material/materialsReturned","tenants":[{"id":"1623811301356297657","code":"1623811301356297657","fullName":"广东博嘉拓建筑测试租户","shortName":"广东博嘉拓建筑测试租户","envId":"6296f5e3960c4fdfb9c9357b581c853b","envName":"默认环境","tenantEnvs":null},{"id":"216572673247394736","code":"9C8D5715AAA44D4B8530AB2B7F627E1A","fullName":"安徽腾越建筑工程有限公司","shortName":"安徽腾越建筑工程有限公司","envId":"d1b4f959495f433fb1dd5400a78bce2c","envName":"默认环境","tenantEnvs":null},{"id":"216317749963825419","code":"C2C35D2543B34CA99366D9C76E45D01B","fullName":"沈阳腾越建筑测试租户","shortName":"沈阳腾越建筑测试租户","envId":"c4a70c0a1f5c4aaa83fcd390dcd898c6","envName":"默认环境","tenantEnvs":null},{"id":"216260762345772077","code":"216260762345772077","fullName":"广东腾越建筑工程有限公司","shortName":"广东腾越建筑工程有限公司","envId":"210712034943271000","envName":"默认环境","tenantEnvs":null},{"id":"216328986981406025","code":"TENANT_TEST","fullName":"智慧工地测试租户9","shortName":"智慧工地测试租户9","envId":"e7682a3876a343b483645b0c20da93a3","envName":"默认环境","tenantEnvs":null},{"id":"216365124588606373","code":"TENANT_TEST","fullName":"计划排程自动化测试","shortName":"计划排程自动化测试","envId":"80ce8eb5a7c941f8a6f57b8ecb61ec17","envName":"默认环境","tenantEnvs":null},{"id":"216674624791091228","code":"232E9186B1BE494E966F27BA7CF33AE2","fullName":"cyq测试","shortName":"cyq测试","envId":"ef3f8ed4792f4ef0a5e7d92af394d29c","envName":"默认环境","tenantEnvs":null},{"id":"216687529947792866","code":"9769454E01304245AEE83CE7E99537A8","fullName":"成本总控报表测试租户","shortName":"成本总控报表测试租户","envId":"5125917072884123bf9fe3966ffa4af2","envName":"默认环境","tenantEnvs":null},{"id":"216661417159402453","code":"216661417159402453","fullName":"科技建筑集团","shortName":"科技建筑集团","envId":"b23d88da977e467cb81dd7fb57de97d0","envName":"默认环境","tenantEnvs":null},{"id":"216281557054332425","code":"216281557054332425","fullName":"BIM材料用量计算","shortName":"BIM材料用量计算","envId":"7501c77b0ccd4b4d912451e5f74c1ba7","envName":"默认环境","tenantEnvs":null},{"id":"1320970534539886592","code":"1320970534539886592","fullName":"碧桂园集团","shortName":"碧桂园集团","envId":"1320970534539886592","envName":"默认环境","tenantEnvs":null}],"loginAppDto":null},"msg":null,"succeed":true}
test_api_2 (test_api.TestProjectApi)执行——>【通过】
</pre>
@ -570,7 +577,7 @@ test_api_2 (test_api.TestProjectApi)执行——>【通过】
<td class="TestProjectApi">TestProjectApi</td>
<td>test_api_4</td>
<td>None</td>
<td>2.18s</td>
<td>2.19s</td>
<td class="text-success">成功</td>
@ -584,12 +591,12 @@ test_api_2 (test_api.TestProjectApi)执行——>【通过】
<td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all">
<pre>发送请求的参数: {'json': '{"projectId":"104966","tvSequence":"rsYoCApagmymLNynqDZd"}', 'headers': '{"Content-Type":"application/json;charset=utf-8","BSP_TOKEN":"3989b7356e0b17173f793d252a89a8b2","BSP_USER_TENANT":"216260762345772077"}'}
请求地址 --> https://bimdc.bzlrobot.com/bsp/test/user/ugs/ibs/api/ibs-lms-base/tvConfig/addTvSequence?t=1687702437038
请求头 --> {'Content-Type': 'application/json;charset=utf-8', 'BSP_TOKEN': '3989b7356e0b17173f793d252a89a8b2', 'BSP_USER_TENANT': '216260762345772077', 'Content-Length': '61'}
请求 body --> b'{"projectId": "104966", "tvSequence": "rsYoCApagmymLNynqDZd"}'
<pre>发送请求的参数: {'json': '{"projectId":"104966","tvSequence":"YNMxlNkKBNRytdGFOaOL"}', 'headers': '{"Content-Type":"application/json;charset=utf-8","BSP_TOKEN":"ef624f367b662e55017d1c19e7e99171","BSP_USER_TENANT":"216260762345772077"}'}
请求地址 --> https://bimdc.bzlrobot.com/bsp/test/user/ugs/ibs/api/ibs-lms-base/tvConfig/addTvSequence?t=1687704335562
请求头 --> {'Content-Type': 'application/json;charset=utf-8', 'BSP_TOKEN': 'ef624f367b662e55017d1c19e7e99171', 'BSP_USER_TENANT': '216260762345772077', 'Content-Length': '61'}
请求 body --> b'{"projectId": "104966", "tvSequence": "YNMxlNkKBNRytdGFOaOL"}'
接口状态--> 200
接口耗时--> 0:00:00.062146
接口耗时--> 0:00:00.059342
接口响应--> {"code":200,"success":true,"data":null,"msg":"添加成功"}
test_api_4 (test_api.TestProjectApi)执行——>【通过】
</pre>
@ -603,7 +610,7 @@ test_api_4 (test_api.TestProjectApi)执行——>【通过】
<td class="TestProjectApi">TestProjectApi</td>
<td>test_api_5</td>
<td>None</td>
<td>3.13s</td>
<td>3.14s</td>
<td class="text-success">成功</td>
@ -617,12 +624,12 @@ test_api_4 (test_api.TestProjectApi)执行——>【通过】
<td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all">
<pre>发送请求的参数: {'params': None, 'headers': '{"Content-Type":"application/json;charset=utf-8","BSP_TOKEN":"3989b7356e0b17173f793d252a89a8b2","BSP_USER_TENANT":"216260762345772077"}'}
请求地址 --> https://bimdc.bzlrobot.com/bsp/test/user/ugs/ibs/api/ibs-lms-base/tvConfig/getTvInfo?t=1687702440219&projectId=104966
请求头 --> {'Content-Type': 'application/json;charset=utf-8', 'BSP_TOKEN': '3989b7356e0b17173f793d252a89a8b2', 'BSP_USER_TENANT': '216260762345772077'}
<pre>发送请求的参数: {'params': None, 'headers': '{"Content-Type":"application/json;charset=utf-8","BSP_TOKEN":"ef624f367b662e55017d1c19e7e99171","BSP_USER_TENANT":"216260762345772077"}'}
请求地址 --> https://bimdc.bzlrobot.com/bsp/test/user/ugs/ibs/api/ibs-lms-base/tvConfig/getTvInfo?t=1687704338749&projectId=104966
请求头 --> {'Content-Type': 'application/json;charset=utf-8', 'BSP_TOKEN': 'ef624f367b662e55017d1c19e7e99171', 'BSP_USER_TENANT': '216260762345772077'}
请求 body --> None
接口状态--> 200
接口耗时--> 0:00:00.028691
接口耗时--> 0:00:00.026632
接口响应--> {"code":200,"success":true,"data":{"id":"1637650408413749249","projectId":"104966","shortInfo":"博智林提醒您:一切不能保证安全、质量的施工都要停工!进入工地,请佩戴安全帽,穿着反光衣,文明作业!","qrCode":"https://ibs-test.bzlrobot.com/api/ibs-file/document/get/MjAyMS0xMC0xOCxQSE9UT18yMDIxMTAxOF8wOTMxMDExMDIuanBnLDA0ZGQxOWU5YzA3MjQ0YjE5OTIwNzZjOTUxNzY4YzQ1","manageDeparts":[]},"msg":"操作成功"}
test_api_5 (test_api.TestProjectApi)执行——>【通过】
</pre>
@ -675,12 +682,12 @@ test_api_5 (test_api.TestProjectApi)执行——>【通过】
"fail": `0`,
"skip": '0',
"error": `0`,
"runtime": '6.60 S',
"begin_time": "6.60 S",
"runtime": '6.65 S',
"begin_time": "6.65 S",
"pass_rate": '100.00',
}
;
const history = [{'success': 4, 'all': 7, 'fail': 1, 'skip': 0, 'error': 2, 'runtime': '0.45 S', 'begin_time': '2023-04-21 12:10:31', 'pass_rate': '57.14'}, {'success': 0, 'all': 1, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '0.01 S', 'begin_time': '2023-04-21 12:11:52', 'pass_rate': '0.00'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.33 S', 'begin_time': '2023-04-21 12:12:54', 'pass_rate': '83.33'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.30 S', 'begin_time': '2023-04-21 12:13:32', 'pass_rate': '83.33'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.28 S', 'begin_time': '2023-04-21 14:47:43', 'pass_rate': '83.33'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.27 S', 'begin_time': '2023-04-21 15:01:06', 'pass_rate': '83.33'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.24 S', 'begin_time': '2023-04-21 15:03:53', 'pass_rate': '83.33'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.23 S', 'begin_time': '2023-04-21 15:06:10', 'pass_rate': '83.33'}, {'success': 6, 'all': 7, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '3.00 S', 'begin_time': '2023-05-14 23:58:13', 'pass_rate': '85.71'}, {'success': 0, 'all': 2, 'fail': 0, 'skip': 0, 'error': 2, 'runtime': '0.02 S', 'begin_time': '2023-05-15 11:52:27', 'pass_rate': '0.00'}, {'success': 0, 'all': 2, 'fail': 0, 'skip': 0, 'error': 2, 'runtime': '0.00 S', 'begin_time': '2023-05-15 11:57:23', 'pass_rate': '0.00'}, {'success': 6, 'all': 7, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '1.38 S', 'begin_time': '2023-05-15 11:59:30', 'pass_rate': '85.71'}, {'success': 6, 'all': 7, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '1.44 S', 'begin_time': '2023-05-16 15:11:50', 'pass_rate': '85.71'}, {'success': 6, 'all': 7, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '1.28 S', 'begin_time': '2023-05-17 17:12:52', 'pass_rate': '85.71'}, {'success': 0, 'all': 1, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '0.00 S', 'begin_time': '2023-05-17 17:17:15', 'pass_rate': '0.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '1.33 S', 'begin_time': '2023-05-17 17:21:07', 'pass_rate': '100.00'}, {'success': 0, 'all': 1, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '0.00 S', 'begin_time': '2023-06-14 15:16:14', 'pass_rate': '0.00'}, {'success': 82, 'all': 82, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.38 S', 'begin_time': '2023-06-16 16:22:27', 'pass_rate': '100.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.32 S', 'begin_time': '2023-06-16 16:26:52', 'pass_rate': '100.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.35 S', 'begin_time': '2023-06-16 16:30:50', 'pass_rate': '100.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.33 S', 'begin_time': '2023-06-16 16:32:32', 'pass_rate': '100.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.32 S', 'begin_time': '2023-06-16 16:36:00', 'pass_rate': '100.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.60 S', 'begin_time': '2023-06-25 22:13:53', 'pass_rate': '100.00'}];
const history = [{'success': 4, 'all': 7, 'fail': 1, 'skip': 0, 'error': 2, 'runtime': '0.45 S', 'begin_time': '2023-04-21 12:10:31', 'pass_rate': '57.14'}, {'success': 0, 'all': 1, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '0.01 S', 'begin_time': '2023-04-21 12:11:52', 'pass_rate': '0.00'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.33 S', 'begin_time': '2023-04-21 12:12:54', 'pass_rate': '83.33'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.30 S', 'begin_time': '2023-04-21 12:13:32', 'pass_rate': '83.33'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.28 S', 'begin_time': '2023-04-21 14:47:43', 'pass_rate': '83.33'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.27 S', 'begin_time': '2023-04-21 15:01:06', 'pass_rate': '83.33'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.24 S', 'begin_time': '2023-04-21 15:03:53', 'pass_rate': '83.33'}, {'success': 5, 'all': 6, 'fail': 1, 'skip': 0, 'error': 0, 'runtime': '0.23 S', 'begin_time': '2023-04-21 15:06:10', 'pass_rate': '83.33'}, {'success': 6, 'all': 7, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '3.00 S', 'begin_time': '2023-05-14 23:58:13', 'pass_rate': '85.71'}, {'success': 0, 'all': 2, 'fail': 0, 'skip': 0, 'error': 2, 'runtime': '0.02 S', 'begin_time': '2023-05-15 11:52:27', 'pass_rate': '0.00'}, {'success': 0, 'all': 2, 'fail': 0, 'skip': 0, 'error': 2, 'runtime': '0.00 S', 'begin_time': '2023-05-15 11:57:23', 'pass_rate': '0.00'}, {'success': 6, 'all': 7, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '1.38 S', 'begin_time': '2023-05-15 11:59:30', 'pass_rate': '85.71'}, {'success': 6, 'all': 7, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '1.44 S', 'begin_time': '2023-05-16 15:11:50', 'pass_rate': '85.71'}, {'success': 6, 'all': 7, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '1.28 S', 'begin_time': '2023-05-17 17:12:52', 'pass_rate': '85.71'}, {'success': 0, 'all': 1, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '0.00 S', 'begin_time': '2023-05-17 17:17:15', 'pass_rate': '0.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '1.33 S', 'begin_time': '2023-05-17 17:21:07', 'pass_rate': '100.00'}, {'success': 0, 'all': 1, 'fail': 0, 'skip': 0, 'error': 1, 'runtime': '0.00 S', 'begin_time': '2023-06-14 15:16:14', 'pass_rate': '0.00'}, {'success': 82, 'all': 82, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.38 S', 'begin_time': '2023-06-16 16:22:27', 'pass_rate': '100.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.32 S', 'begin_time': '2023-06-16 16:26:52', 'pass_rate': '100.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.35 S', 'begin_time': '2023-06-16 16:30:50', 'pass_rate': '100.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.33 S', 'begin_time': '2023-06-16 16:32:32', 'pass_rate': '100.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.32 S', 'begin_time': '2023-06-16 16:36:00', 'pass_rate': '100.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.60 S', 'begin_time': '2023-06-25 22:13:53', 'pass_rate': '100.00'}, {'success': 6, 'all': 6, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '6.65 S', 'begin_time': '2023-06-25 22:45:32', 'pass_rate': '100.00'}];
var passRate = [];
var dTime = [];

View File

@ -32,11 +32,11 @@ class TestProjectApi(unittest.TestCase):
cls.action.set_variable(initialize_data) # 加载初始化数据
cls.action.set_bif_fun(bif_functions) # 加载内置方法
@data(*test_case) # {"":""}
def test_api(self, item): # item = {測試用例}
# f"""用例描述{item.get("name")}_{item.get("desc")}"""
@data(*test_case)
def test_api(self, item):
# f"""用例{item.get("name")}_{item.get("desc")}"""
sheet, item_id, condition, st, name, desc, headers_crypto, request_crypto, method = self.__base_info(
sheet, iid, condition, st, name, desc, headers_crypto, request_crypto, method = self.__base_info(
item)
regex, keys, deps, jp_dict, extract_request_data = self.__extractor_info(item)
@ -51,7 +51,7 @@ class TestProjectApi(unittest.TestCase):
self.__exc_sql(sql, sql_params_dict, method)
# 拼接动态代码段文件
prepost_script = f"prepost_script_{sheet}_{item_id}.py"
prepost_script = f"prepost_script_{sheet}_{iid}.py"
item = self.action.load_and_execute_script(Config.SCRIPTS_DIR, prepost_script, "setup", item)
@ -62,8 +62,7 @@ class TestProjectApi(unittest.TestCase):
# 提取请求参数信息
self.action.substitute_data(request_data, jp_dict=jp_dict)
headers, request_data = self.action.encrypt_data.encrypt_data(headers_crypto, headers, request_crypto,
request_data)
headers, request_data = self.action.encrypt.encrypts(headers_crypto, headers, request_crypto, request_data)
result_tuple = None
result = "PASS"
@ -83,11 +82,10 @@ class TestProjectApi(unittest.TestCase):
self.assertNotIn("FAIL", result_tuple, "FAIL 存在结果元组中")
try:
# 提取响应
self.action.substitute_data(response.json(), regex=regex, keys=keys, deps=deps,
jp_dict=jp_dict)
self.action.substitute_data(response.json(), regex=regex, keys=keys, deps=deps, jp_dict=jp_dict)
except Exception as err:
logger.error(f"提取响应失败:{sheet}_{item_id}_{name}_{desc}"
logger.error(f"提取响应失败:{sheet}_{iid}_{name}_{desc}"
f"\nregex={regex};"
f" \nkeys={keys};"
f"\ndeps={deps};"
@ -95,15 +93,14 @@ class TestProjectApi(unittest.TestCase):
f"\n{err}")
except Exception as e:
result = "FAIL"
logger.error(f'异常用例: {sheet}_{item_id}_{name}_{desc}\n{e}')
logger.error(f'异常用例: {sheet}_{iid}_{name}_{desc}\n{e}')
raise e
finally:
response_value = response.text if response is not None else str(response)
response = response.text if response is not None else str(response)
assert_log = str(result_tuple)
# 响应结果及测试结果回写 excel
excel.write_back(sheet_name=sheet, i=item_id, response=response_value, test_result=result,
assert_log=assert_log)
excel.write_back(sheet_name=sheet, i=iid, response=response, test_result=result, assert_log=assert_log)
@classmethod
def tearDownClass(cls) -> None: