Commit f371042a authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

parent 0d59ae7e
...@@ -53,7 +53,7 @@ manufacturer = result["data"]["list"][product_random]["manufacturer"] ...@@ -53,7 +53,7 @@ manufacturer = result["data"]["list"][product_random]["manufacturer"]
# 第四步进行可使用商品返利清单查询 # 第四步进行可使用商品返利清单查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url36") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url36")
request_body = commonFuc().get_business_data(module, "payload36", product_name, product_code, specifications, request_body = commonFuc().get_business_data(module, "payload36", product_name, product_code, specifications,
manufacturer) manufacturer, rebate_trip_td)
""" """
场景: 列表查询条件验证_可使用商品返利清单 场景: 列表查询条件验证_可使用商品返利清单
......
...@@ -50,7 +50,7 @@ customer_code = result["data"]["list"][product_random]["customerCode"] ...@@ -50,7 +50,7 @@ customer_code = result["data"]["list"][product_random]["customerCode"]
# 第四步进行可发放客户清单查询 # 第四步进行可发放客户清单查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url38") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url38")
request_body = commonFuc().get_business_data(module, "payload38", customer_name, customer_code) request_body = commonFuc().get_business_data(module, "payload38", rebate_trip_td, customer_name, customer_code)
print(request_body) print(request_body)
""" """
场景: 列表查询条件验证_可发放客户清单 场景: 列表查询条件验证_可发放客户清单
......
...@@ -42,32 +42,39 @@ request_body = commonFuc().get_business_data(module, "payload11", rebate_id) ...@@ -42,32 +42,39 @@ request_body = commonFuc().get_business_data(module, "payload11", rebate_id)
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)
# print(result) # print(result)
# 生成一个随机数字,用于后续随机选择商品 if result["data"]["list"]:
product_random = random.randint(0, len(result["data"]["list"]) - 1) # 生成一个随机数字,用于后续随机选择商品
# 获取商品黑名单中商品信息 product_random = random.randint(0, len(result["data"]["list"]) - 1)
product_name = result["data"]["list"][product_random]["productname"] # 获取商品黑名单中商品信息
product_code = result["data"]["list"][product_random]["productcode"] product_name = result["data"]["list"][product_random]["productname"]
specifications = result["data"]["list"][product_random]["specifications"] product_code = result["data"]["list"][product_random]["productcode"]
manufacturer = result["data"]["list"][product_random]["manufacturer"] specifications = result["data"]["list"][product_random]["specifications"]
manufacturer = result["data"]["list"][product_random]["manufacturer"]
# 第四步进行条件查询验证 # 第四步进行条件查询验证
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url12") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url12")
request_body = commonFuc().get_business_data(module, "payload12", product_name, product_code, specifications, request_body = commonFuc().get_business_data(module, "payload12", rebate_id, product_name, product_code, specifications,
manufacturer) manufacturer)
""" """
场景: 验证商品黑名单列表查询条件是否可以正常使用 场景: 验证商品黑名单列表查询条件是否可以正常使用
用例名称:列表查询条件验证_商品黑名单 用例名称:列表查询条件验证_商品黑名单
输出:{"productname":"%s"} 输出:{"productname":"%s"}
""" """
# 发送请求 # 发送请求
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)
# print(result) # print(result)
# 获取查询结果中商品对应的商品名称 # 获取查询结果中商品对应的商品名称
result = {"productname": result["data"]["list"][0]["productname"]} result = {"productname": result["data"]["list"][0]["productname"]}
# 获取预期结果 # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict12", product_name) check_dict = commonFuc().get_business_data(module, "checkDict12", product_name)
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) commonFuc().check_result(check_dict, result)
else:
result = {"list": result["data"]["list"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict12_1")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
\ No newline at end of file
...@@ -34,14 +34,14 @@ rebate_random = random.randint(0, len(result["data"]["list"]) - 1) ...@@ -34,14 +34,14 @@ rebate_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取返利规则信息 # 获取返利规则信息
rebate_id = result["data"]["list"][rebate_random]["rebateid"] rebate_id = result["data"]["list"][rebate_random]["rebateid"]
print(rebate_id)
# 第三步获取返利规则对应的客户范围 # 第三步获取返利规则对应的客户范围
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url13") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url13")
request_body = commonFuc().get_business_data(module, "payload13", rebate_id) request_body = commonFuc().get_business_data(module, "payload13", rebate_id)
# 发送请求 # 发送请求
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)
print(result)
# 生成一个随机数字,用于后续随机选择某一条客户信息 # 生成一个随机数字,用于后续随机选择某一条客户信息
customer_random = random.randint(0, len(result["data"]["list"]) - 1) customer_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取返利规则中客户范围列表中某一条客户信息 # 获取返利规则中客户范围列表中某一条客户信息
...@@ -50,7 +50,8 @@ customer_code = result["data"]["list"][customer_random]["customercode"] ...@@ -50,7 +50,8 @@ customer_code = result["data"]["list"][customer_random]["customercode"]
# 第四步进行条件查询验证 # 第四步进行条件查询验证
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url14") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url14")
request_body = commonFuc().get_business_data(module, "payload14", customer_name, customer_code) request_body = commonFuc().get_business_data(module, "payload14", customer_name, customer_code, rebate_id)
print(request_body)
""" """
场景: 验证返利规则对应的客户范围列表查询条件是否可以正常使用 场景: 验证返利规则对应的客户范围列表查询条件是否可以正常使用
...@@ -61,7 +62,7 @@ request_body = commonFuc().get_business_data(module, "payload14", customer_name, ...@@ -61,7 +62,7 @@ request_body = commonFuc().get_business_data(module, "payload14", customer_name,
# 发送请求 # 发送请求
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)
# print(result) print(result)
# 获取查询结果对应的客户编号 # 获取查询结果对应的客户编号
result = {"customercode": result["data"]["list"][0]["customercode"]} result = {"customercode": result["data"]["list"][0]["customercode"]}
# 获取预期结果 # 获取预期结果
......
...@@ -48,7 +48,7 @@ request_body = commonFuc().get_business_data(module, "payload37", rebate_trip_td ...@@ -48,7 +48,7 @@ request_body = commonFuc().get_business_data(module, "payload37", rebate_trip_td
# 发送请求 # 发送请求
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)
# print(result) print(result)
# 获取预期结果 # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict37") check_dict = commonFuc().get_business_data(module, "checkDict37")
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
......
...@@ -108,9 +108,10 @@ checkDict11_1: {"total":"%s"} ...@@ -108,9 +108,10 @@ checkDict11_1: {"total":"%s"}
#测试场景十三:列表查询条件验证_商品黑名单 #测试场景十三:列表查询条件验证_商品黑名单
"url12": "/order/rebateProduct/getList" "url12": "/order/rebateProduct/getList"
"payload12": {"rebateid":111,"productname":"%s","productcode":"%s","specifications":"%s","manufacturer":"%s","pageNum":1,"pageSize":10,"pageTotal":0} "payload12": {"rebateid":"%s","productname":"%s","productcode":"%s","specifications":"%s","manufacturer":"%s","pageNum":1,"pageSize":10,"pageTotal":0}
#预期结果 #预期结果
checkDict12: {"productname":"%s"} checkDict12: {"productname":"%s"}
checkDict12_1: {"list":[]}
#测试场景十四:返利规则商品客户范围查询验证 #测试场景十四:返利规则商品客户范围查询验证
"url13": "/order/rebateUser/getList" "url13": "/order/rebateUser/getList"
...@@ -121,7 +122,7 @@ checkDict13_1: {"total":"%s"} ...@@ -121,7 +122,7 @@ checkDict13_1: {"total":"%s"}
#测试场景十五:列表查询条件验证_客户范围 #测试场景十五:列表查询条件验证_客户范围
"url14": "/order/rebateUser/getList" "url14": "/order/rebateUser/getList"
"payload14": {"templateId":null,"customername":"%s","customercode":"%s","pageNum":1,"pageTotal":1,"pageSize":10,"rebateid":111} "payload14": {"templateId":null,"customername":"%s","customercode":"%s","pageNum":1,"pageTotal":1,"pageSize":10,"rebateid":"%s"}
#预期结果 #预期结果
checkDict14: {"customercode":"%s"} checkDict14: {"customercode":"%s"}
...@@ -285,7 +286,7 @@ checkDict35_1: {"total":"%s"} ...@@ -285,7 +286,7 @@ checkDict35_1: {"total":"%s"}
#测试场景三十八:列表查询条件验证_可使用商品返利清单 #测试场景三十八:列表查询条件验证_可使用商品返利清单
"url36": "/order/public/rebatetripPro/getRebatetripProList" "url36": "/order/public/rebatetripPro/getRebatetripProList"
"payload36": {"productname":"%s","productcode":"%s","specifications":"%s","manufacturer":"%s","rebateTripId":1,"pageNum":1,"pageSize":10,"pageTotal":1} "payload36": {"productname":"%s","productcode":"%s","specifications":"%s","manufacturer":"%s","rebateTripId":"%s","pageNum":1,"pageSize":10,"pageTotal":1}
#预期结果 #预期结果
checkDict36: {"productCode":"%s"} checkDict36: {"productCode":"%s"}
...@@ -300,7 +301,7 @@ checkDict37_1: {"total":"%s"} ...@@ -300,7 +301,7 @@ checkDict37_1: {"total":"%s"}
#测试场景四十:列表查询条件验证_可发放客户清单 #测试场景四十:列表查询条件验证_可发放客户清单
"url38": "/order/public/rebatetripCus/getRebatetripCusList" "url38": "/order/public/rebatetripCus/getRebatetripCusList"
"payload38": {"rebateTripId":1,"customername":"%s","customercode":"%s","pageNum":1,"pageTotal":1,"pageSize":10} "payload38": {"rebateTripId":"%s","customername":"%s","customercode":"%s","pageNum":1,"pageTotal":1,"pageSize":10}
#预期结果 #预期结果
checkDict38: {"customerCode":"%s"} checkDict38: {"customerCode":"%s"}
......
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