Skip to content
GitLab
Explore
Projects
Groups
Snippets
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
d982addc
Commit
d982addc
authored
1 year ago
by
liguangyu06
Browse files
Options
Download
Email Patches
Plain Diff
用例优化
parent
a78234b9
main
master
1 merge request
!5
Master|更新商品模块和订单逆向模块用例
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
air_case/cmdc_buyercart_handle/购物车列表查询条件验证.air/购物车列表查询条件验证.py
+4
-3
...case/cmdc_buyercart_handle/购物车列表查询条件验证.air/购物车列表查询条件验证.py
air_case/cmdc_buyercart_handle/购物车支持跨站商品下单验证.air/购物车支持跨站商品下单验证.py
+8
-1
.../cmdc_buyercart_handle/购物车支持跨站商品下单验证.air/购物车支持跨站商品下单验证.py
with
12 additions
and
4 deletions
+12
-4
air_case/cmdc_buyercart_handle/购物车列表查询条件验证.air/购物车列表查询条件验证.py
+
4
-
3
View file @
d982addc
...
...
@@ -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
][
"
product
Id"
]
}
# # 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict3"
)
...
...
This diff is collapsed.
Click to expand it.
air_case/cmdc_buyercart_handle/购物车支持跨站商品下单验证.air/购物车支持跨站商品下单验证.py
+
8
-
1
View file @
d982addc
...
...
@@ -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
]
# 第四步,进行商品的选择
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets