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
6b55a749
Commit
6b55a749
authored
Jan 11, 2024
by
liguangyu06
Browse files
用例新增:产品详情获取以及查询条件验证
parent
303140c8
Changes
3
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_product/查询条件验证_产品线详情.air/查询条件验证_产品线详情.py
0 → 100644
View file @
6b55a749
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc查询条件验证_产品线详情,2293,2293-084,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
,
"url77"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload77"
)
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
product_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取产品线包含商品信息
product_code
=
result
[
"data"
][
"list"
][
product_random
][
"productCode"
]
product_name
=
result
[
"data"
][
"list"
][
product_random
][
"productName"
]
specifications
=
result
[
"data"
][
"list"
][
product_random
][
"specifications"
]
material_code
=
result
[
"data"
][
"list"
][
product_random
][
"materialCode"
]
manufacturer
=
result
[
"data"
][
"list"
][
product_random
][
"manufacturer"
]
# 进行查询条件验证
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url78"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload78"
,
product_code
,
product_name
,
specifications
,
material_code
,
manufacturer
)
"""
场景: 产品详情页面查询条件验证
用例名称:查询条件验证_产品线详情
输出:{"productCode":"%s"}
"""
# 发送请求
result
=
requests
.
post
(
url
,
json
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# print(result)
# 获取查询结果中商品code
result
=
{
"productCode"
:
result
[
"data"
][
"list"
][
0
][
"productCode"
]}
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict78"
,
product_code
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
air_case/cmdc_product/获取产品线详情.air/获取产品线详情.py
0 → 100644
View file @
6b55a749
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc获取产品线详情,2293,2293-083,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
,
"url77"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload77"
)
"""
场景: 验证获取产品线详情接口连通性
用例名称:获取产品线详情
输出:{"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
,
"checkDict77"
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
data/cmdc_product/data
View file @
6b55a749
...
@@ -551,9 +551,17 @@ checkDict75: {"realName":"%s"}
...
@@ -551,9 +551,17 @@ checkDict75: {"realName":"%s"}
#预期结果
#预期结果
checkDict76: {"success":false,"code":"200","message":"操作成功!","data":null,"freshToken":null}
checkDict76: {"success":false,"code":"200","message":"操作成功!","data":null,"freshToken":null}
#测试场景七十七:获取产品线详情
"url77": "/product/back/queryProductLineDetail"
"payload77": {"productCode":"","productName":"","specifications":"","materialCode":"","manufacturer":"","pageNum":1,"pageSize":10,"productLineCode":"3041"}
#预期结果
checkDict77: {"success":true,"code":"200","message":"OK"}
#测试场景七十八:查询条件验证_产品线详情
"url78": "/product/back/queryProductLineDetail"
"payload78": {"productCode":"%s","productName":"%s","specifications":"%s","materialCode":"%s","manufacturer":"%s","pageNum":1,"pageSize":10,"productLineCode":"3041"}
#预期结果
checkDict78: {"productCode":"%s"}
...
...
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