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
22ea88d8
Commit
22ea88d8
authored
Nov 03, 2023
by
liguangyu06
Browse files
用例优化
parent
0f82bd72
Changes
2
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_special_fresenius_group/套包协议特价查询.air/套包协议特价查询.py
View file @
22ea88d8
...
@@ -37,17 +37,19 @@ result = json.loads(result.content)
...
@@ -37,17 +37,19 @@ result = json.loads(result.content)
# 获取套包协议特价总数量
# 获取套包协议特价总数量
result
=
{
"total"
:
result
[
"data"
][
"total"
]}
result
=
{
"total"
:
result
[
"data"
][
"total"
]}
print
(
result
)
# 数据库操作
# 数据库操作
mysql_handle
=
mySql
()
mysql_handle
=
mySql
()
# 获取conf.ini文件中配置的数据库信息
# 获取conf.ini文件中配置的数据库信息
host
,
port
,
user
,
pwd
=
mysql_handle
.
getConf
(
db
=
"cmdc_db"
)
host
,
port
,
user
,
pwd
=
mysql_handle
.
getConf
(
db
=
"cmdc_db"
)
# 数据库查询套包正价数量
# 数据库查询协议价套包数量(套包存在且非停用下架状态,不是正价套包即isRegularPrice = 0)
sql
=
"SELECT t.groupId FROM `cmdc-order`.tc_fresenius_agreement_price t "
\
sql
=
"SELECT t.* FROM `cmdc-order`.tc_fresenius_agreement_price t "
\
"WHERE isRegularPrice = 0 and groupPriceStatus = 1 and companyCode = 00111"
"WHERE companyCode = 00111 and isRegularPrice = 0 and "
\
"groupId in (SELECT t.groupId FROM `cmdc-order`.tc_fresenius_group t "
\
"WHERE status = 1 and groupType = 0);"
total
=
len
(
mysql_handle
.
selectSql
(
host
,
port
,
user
,
pwd
,
"cmdc-order"
,
sql
))
total
=
len
(
mysql_handle
.
selectSql
(
host
,
port
,
user
,
pwd
,
"cmdc-order"
,
sql
))
print
(
total
)
# 获取预期结果
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict3"
,
total
)
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict3"
,
total
)
# 断言实际结果中是否包含预期结果的内容
# 断言实际结果中是否包含预期结果的内容
...
...
air_case/cmdc_special_fresenius_group/批量新增_套包商品管理.air/批量新增_套包商品管理.py
View file @
22ea88d8
...
@@ -36,12 +36,10 @@ result = requests.post(url, headers=headers, json=request_body)
...
@@ -36,12 +36,10 @@ result = requests.post(url, headers=headers, json=request_body)
result
=
json
.
loads
(
result
.
content
)
result
=
json
.
loads
(
result
.
content
)
# 随机获取不相同两个商品信息
# 随机获取不相同两个商品信息
product_id_a
=
random
.
randint
(
1
,
len
(
result
[
"data"
][
"list"
])
-
2
)
product_id_a
=
random
.
randint
(
1
,
len
(
result
[
"data"
][
"list"
])
-
1
)
print
(
product_id_a
)
product_code_a
=
result
[
"data"
][
"list"
][
product_id_a
][
"productCode"
]
product_code_a
=
result
[
"data"
][
"list"
][
product_id_a
][
"productCode"
]
product_name_a
=
result
[
"data"
][
"list"
][
product_id_a
][
"productName"
]
product_name_a
=
result
[
"data"
][
"list"
][
product_id_a
][
"productName"
]
product_id_b
=
random
.
randint
(
product_id_a
,
len
(
result
[
"data"
][
"list"
])
-
1
)
product_id_b
=
random
.
randint
(
product_id_a
+
1
,
len
(
result
[
"data"
][
"list"
]))
print
(
product_id_b
)
product_code_b
=
result
[
"data"
][
"list"
][
product_id_b
][
"productCode"
]
product_code_b
=
result
[
"data"
][
"list"
][
product_id_b
][
"productCode"
]
product_name_b
=
result
[
"data"
][
"list"
][
product_id_b
][
"productName"
]
product_name_b
=
result
[
"data"
][
"list"
][
product_id_b
][
"productName"
]
...
@@ -85,4 +83,3 @@ print(result)
...
@@ -85,4 +83,3 @@ print(result)
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict12"
)
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict12"
)
# 断言实际结果中是否包含预期结果的内容
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
commonFuc
().
check_result
(
check_dict
,
result
)
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