Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
test
autotest-airtest-web-cmdc
Commits
6a379d79
Commit
6a379d79
authored
Jan 16, 2024
by
liguangyu06
Browse files
增加接口响应时间获取
parent
a8c59633
Changes
57
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_buyercar_list/新增不存在商品至购物车列表.air/新增不存在商品至购物车列表.py
View file @
6a379d79
...
...
@@ -38,6 +38,7 @@ result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict4"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/新增商品至购物车_商品超数量验证.air/新增商品至购物车_商品超数量验证.py
View file @
6a379d79
...
...
@@ -38,6 +38,7 @@ result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict36"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/新增商品至购物车_必填字段校验.air/新增商品至购物车_必填字段校验.py
View file @
6a379d79
...
...
@@ -38,6 +38,7 @@ result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict20"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/新增商品至购物车_站点不存在或者站点已下架.air/新增商品至购物车_站点不存在或者站点已下架.py
View file @
6a379d79
...
...
@@ -38,6 +38,7 @@ result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict35"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/新增已失效商品至购物车列表.air/新增已失效商品至购物车列表.py
View file @
6a379d79
...
...
@@ -58,6 +58,7 @@ result = requests.post(url1, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict5"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/新增已控销商品至购物车列表.air/新增已控销商品至购物车列表.py
View file @
6a379d79
...
...
@@ -58,6 +58,7 @@ if result["data"]["list"][0]["isControlSales"] == 1:
# 获取接口响应时间
api_time
=
result1
.
elapsed
.
total_seconds
()
result1
=
json
.
loads
(
result1
.
content
)
result1
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict7"
)
print
(
check_dict
)
...
...
air_case/cmdc_buyercar_list/新增赠品_控销_商品至购物车.air/新增赠品_控销_商品至购物车.py
View file @
6a379d79
...
...
@@ -58,6 +58,7 @@ result1 = requests.post(url1, json=request_body1, headers=headers1)
# 获取接口响应时间
api_time
=
result1
.
elapsed
.
total_seconds
()
result1
=
json
.
loads
(
result1
.
content
)
result1
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict11"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/新增赠品至购物车.air/新增赠品至购物车.py
View file @
6a379d79
...
...
@@ -55,6 +55,7 @@ result1 = requests.post(url1, json=request_body1, headers=headers1)
# 获取接口响应时间
api_time
=
result1
.
elapsed
.
total_seconds
()
result1
=
json
.
loads
(
result1
.
content
)
result1
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict8"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/新增跨站点商品至购物车.air/新增跨站点商品至购物车.py
View file @
6a379d79
...
...
@@ -45,6 +45,7 @@ result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict300"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/添加JDE已停用的商品至购物车列表.air/添加JDE已停用的商品至购物车列表.py
View file @
6a379d79
...
...
@@ -55,6 +55,7 @@ result1 = requests.post(url1, json=request_body1, headers=headers1)
# 获取接口响应时间
api_time
=
result1
.
elapsed
.
total_seconds
()
result1
=
json
.
loads
(
result1
.
content
)
result1
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict10"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/获取购物车列表.air/获取购物车列表.py
View file @
6a379d79
...
...
@@ -36,6 +36,7 @@ result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
result
[
"api_time"
]
=
api_time
# print(result)
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict1"
)
...
...
air_case/cmdc_buyercar_list/购物车商品移除.air/购物车商品移除.py
View file @
6a379d79
...
...
@@ -73,6 +73,7 @@ if result_product_id == product_id:
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict2"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/购物车数量修改验证.air/购物车数量修改验证.py
View file @
6a379d79
...
...
@@ -59,6 +59,7 @@ if invalid_sign == 0:
for
i
in
result2
[
"data"
][
"list"
][
0
][
"list"
]:
if
i
[
"buyerCartId"
]
==
buyercart_id
:
result3
=
i
[
"quantity"
]
result
[
"api_time"
]
=
api_time
check_dict3
=
commonFuc
().
get_business_data
(
module
,
"checkDict81"
,
result3
)
check_dict4
=
commonFuc
().
get_business_data
(
module
,
"checkDict82"
,
modify_quantity
)
commonFuc
().
check_result
(
check_dict3
,
check_dict4
)
...
...
air_case/cmdc_buyercar_list/购物车新增商品.air/购物车新增商品.py
View file @
6a379d79
...
...
@@ -60,7 +60,7 @@ result1 = requests.post(url1, json=request_body1, headers=headers1)
# 获取接口响应时间
api_time
=
result1
.
elapsed
.
total_seconds
()
result1
=
json
.
loads
(
result1
.
content
)
# print(result1)
result1
[
"api_time"
]
=
api_time
if
result1
[
"success"
]:
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict2"
)
...
...
air_case/cmdc_buyercar_list/通过Excel复制添加商品-子站点不存在.air/通过Excel复制添加商品-子站点不存在.py
View file @
6a379d79
...
...
@@ -38,7 +38,7 @@ result = requests.post(url_batch, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
# print(result)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict24"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/通过Excel复制添加商品-必填字段缺失.air/通过Excel复制添加商品-必填字段缺失.py
View file @
6a379d79
...
...
@@ -36,7 +36,7 @@ result = requests.post(url_batch, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
# print(result)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict22"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/通过Excel复制添加商品-添加失败.air/通过Excel复制添加商品-添加失败.py
View file @
6a379d79
...
...
@@ -38,7 +38,7 @@ result = requests.post(url_batch, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
# print(result)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict21"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_buyercar_list/通过Excel复制添加商品-添加成功.air/通过Excel复制添加商品-添加成功.py
View file @
6a379d79
...
...
@@ -68,7 +68,7 @@ result = requests.post(url_batch, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
# print(result)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict23"
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_commodity_activity/促销活动列表查询条件验证.air/促销活动列表查询条件验证.py
View file @
6a379d79
...
...
@@ -56,6 +56,7 @@ api_time = result.elapsed.total_seconds()
result
=
json
.
loads
(
result
.
content
)
# print(result)
result
=
{
"activityBasicId"
:
result
[
"data"
][
"list"
][
0
][
"activityBasicId"
]}
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict_list"
,
activity_basic_id
)
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_commodity_activity/促销活动列表获取.air/促销活动列表获取.py
View file @
6a379d79
...
...
@@ -37,6 +37,7 @@ result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time
=
result
.
elapsed
.
total_seconds
()
result
=
json
.
loads
(
result
.
content
)
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict1"
)
# 断言实际结果中是否包含预期结果的内容
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment