Commit 7817a9a0 authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

parent 4abcba0f
...@@ -28,33 +28,35 @@ request_body = commonFuc().get_business_data(module, "payload_dis") ...@@ -28,33 +28,35 @@ request_body = commonFuc().get_business_data(module, "payload_dis")
result = requests.post(url, json=request_body, headers=headers) result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content) result = json.loads(result.content)
# 生成随机数 # 判断是否存在配货数据
super_random = random.randint(0, len(result["data"]["list"]) - 1) if result["data"]["list"]:
# 获取配货信息信息 # 生成随机数
distributionCode = result["data"]["list"][super_random]["distributionCode"] super_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取配货信息信息
# 第三步进行配货重置操作 distributionCode = result["data"]["list"][super_random]["distributionCode"]
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url26")
request_body = commonFuc().get_business_data(module, "payload26", distributionCode) # 第三步进行配货重置操作
# print(request_body) url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url26")
""" request_body = commonFuc().get_business_data(module, "payload26", distributionCode)
场景: 重置配货功能验证 # print(request_body)
用例名称:重置配货功能验证 """
输出:{"success":true,"code":"200","message":null,"data":null,"freshToken":null} 场景: 重置配货功能验证
""" 用例名称:重置配货功能验证
输出:{"success":true,"code":"200","message":null,"data":null,"freshToken":null}
# 发送请求 """
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间 # 发送请求
api_time = float(result.elapsed.total_seconds()) result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
# 将接口响应时间添加至result api_time = float(result.elapsed.total_seconds())
result = json.loads(result.content)
result["api_time"] = api_time # 将接口响应时间添加至result
result = json.loads(result.content)
# 获取预期结果 result["api_time"] = api_time
check_dict = commonFuc().get_business_data(module, "checkDict26")
# print(check_dict) # 获取预期结果
# 断言实际结果中是否包含预期结果的内容 check_dict = commonFuc().get_business_data(module, "checkDict26")
commonFuc().check_result(check_dict, result) # print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment