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
7cab85f2
Commit
7cab85f2
authored
1 year ago
by
liguangyu06
Browse files
Options
Download
Email Patches
Plain Diff
用例新增
parent
357dd3d8
main
master
1 merge request
!5
Master|更新商品模块和订单逆向模块用例
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
air_case/cmdc_product/列表查询条件验证_产品线列表.air/列表查询条件验证_产品线列表.py
+59
-0
air_case/cmdc_product/列表查询条件验证_产品线列表.air/列表查询条件验证_产品线列表.py
air_case/cmdc_product/获取产品线列表.air/获取产品线列表.py
+43
-0
air_case/cmdc_product/获取产品线列表.air/获取产品线列表.py
data/cmdc_product/data
+10
-2
data/cmdc_product/data
with
112 additions
and
2 deletions
+112
-2
air_case/cmdc_product/列表查询条件验证_产品线列表.air/列表查询条件验证_产品线列表.py
0 → 100644
+
59
-
0
View file @
7cab85f2
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc列表查询条件验证_产品线列表,2293,2293-026,sit,bs
主数据平台:运营后台管理系统产品线列表接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
random
import
json
module
=
"cmdc_product"
# 获取登录所需账号密码
username
=
commonFuc
().
get_business_data
(
module
,
"username1"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password1"
)
# 获取登录后Cmdc_access_token
cmdc_access_token
=
CmdcDoLogin
(
username
,
password
).
get_token
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers"
,
cmdc_access_token
)
# 获取产品线列表
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url18"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload18"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成一个随机数字,用于后续随机选择某一条商品属性信息
rebate_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取产品线信息
line_code
=
result
[
"data"
][
"list"
][
rebate_random
][
"relevanceCode"
]
line_name
=
result
[
"data"
][
"list"
][
rebate_random
][
"relevanceName"
]
# 进行列表查询
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url19"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload19"
,
line_code
,
line_name
)
"""
场景: 验证产品线列表查询条件
用例名称:列表查询条件验证_产品线列表
输出:{"lineCode":"%s"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# print(result)
# 获取查询结果中产品线
result
=
{
"lineCode"
:
result
[
"data"
][
"list"
][
0
][
"relevanceCode"
]}
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict19"
,
line_code
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
This diff is collapsed.
Click to expand it.
air_case/cmdc_product/获取产品线列表.air/获取产品线列表.py
0 → 100644
+
43
-
0
View file @
7cab85f2
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc获取产品线列表,2293,2293-025,sit,bs
主数据平台:运营后台管理系统产品线列表接口
"""
from
common.common_func
import
commonFuc
from
air_case.cmdc_login.后台管理系统登录.后台管理系统登录
import
CmdcDoLogin
import
requests
import
json
module
=
"cmdc_product"
# 获取登录所需账号密码
username
=
commonFuc
().
get_business_data
(
module
,
"username1"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password1"
)
# 获取登录后Cmdc_access_token
cmdc_access_token
=
CmdcDoLogin
(
username
,
password
).
get_token
()
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers"
,
cmdc_access_token
)
# 获取产品线列表
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url18"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload18"
)
"""
场景: 验证产品线列表接口连通性
用例名称:获取产品线列表
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# print(result)
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict18"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
This diff is collapsed.
Click to expand it.
data/cmdc_product/data
+
10
-
2
View file @
7cab85f2
...
...
@@ -137,9 +137,17 @@ checkDict16: {"supplierName":"%s"}
checkDict17: {"projectName":"%s"}
#测试场景十八:获取产品线列表
"url18": "/product/public/queryDeliveryLineCodeByPage"
"payload18": {"lineCode":"","lineName":"","pageSize":10,"pageNum":1,"total":0}
#预期结果
checkDict18: {"success":true,"code":"200","message":"OK"}
#测试场景十九:列表查询条件验证_产品线列表
"url19": "/product/public/queryDeliveryLineCodeByPage"
"payload19": {"lineCode":"%s","lineName":"%s","pageSize":10,"pageNum":1,"total":null}
#预期结果
checkDict19: {"lineCode":"%s"}
...
...
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