Commit d982addc authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

1 merge request!5Master|更新商品模块和订单逆向模块用例
Showing with 12 additions and 4 deletions
+12 -4
......@@ -24,6 +24,7 @@ headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_toke
# 第二步新增商品至购物车列表
url_add = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url_add")
# 发送请求
request_body2 = commonFuc().get_business_data(module, "payload3")
result2 = requests.post(url_add, json=request_body2, headers=headers)
......@@ -40,9 +41,9 @@ request_body = commonFuc().get_business_data(module, "payload8")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
product_id = result["data"]["list"][0]["list"][0]["productId"]
# print(product_id)
result = {"productId": product_id}
# 获取查询结果中商品id
result = {"productId": result["data"]["list"][0]["list"][0]["productId"]}
# # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict3")
......
......@@ -35,6 +35,7 @@ result2 = json.loads(result2.content)
check_dict1 = commonFuc().get_business_data(module, "checkDict1")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict1, result2)
"""
场景:购物车支持跨站商品下单验证
用例名称:购物车支持跨站商品下单验证
......@@ -45,15 +46,21 @@ commonFuc().check_result(check_dict1, result2)
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
# 获取102站点商品对应的id值
request_body = commonFuc().get_business_data(module, "payload4")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取添加至购物车列表商品对应的buyerCartId
buyercart_id_102 = result["data"]["list"][0]["list"][0]["buyerCartId"]
# print(buyercart_id_102)
# 获取103站点商品对应的id值
request_body = commonFuc().get_business_data(module, "payload5")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取添加至购物车列表商品对应的buyerCartId
buyercart_id_103 = result["data"]["list"][0]["list"][0]["buyerCartId"]
# 将获取到商品对应的buyerCartId添加至同一个字典中,便于后续传参
buyercart_its = [buyercart_id_102, buyercart_id_103]
# 第四步,进行商品的选择
......
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