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
64d638c1
Commit
64d638c1
authored
10 months ago
by
liguangyu06
Browse files
Options
Download
Email Patches
Plain Diff
用例优化
parent
44d93fb7
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
air_case/cmdc_hospital/列表查询条件验证_经销商关联医院管理列表.air/列表查询条件验证_经销商关联医院管理列表.py
+32
-30
...hospital/列表查询条件验证_经销商关联医院管理列表.air/列表查询条件验证_经销商关联医院管理列表.py
with
32 additions
and
30 deletions
+32
-30
air_case/cmdc_hospital/列表查询条件验证_经销商关联医院管理列表.air/列表查询条件验证_经销商关联医院管理列表.py
+
32
-
30
View file @
64d638c1
...
...
@@ -28,38 +28,40 @@ request_body = commonFuc().get_business_data(module, "payload4")
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
result
=
json
.
loads
(
result
.
content
)
# 生成随机数
hospital_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取经销商关联医院信息
customerCode
=
result
[
"data"
][
"list"
][
hospital_random
][
"customerCode"
]
customerName
=
result
[
"data"
][
"list"
][
hospital_random
][
"customerName"
]
hospitalCode
=
result
[
"data"
][
"list"
][
hospital_random
][
"hospitalCode"
]
hospitalName
=
result
[
"data"
][
"list"
][
hospital_random
][
"hospitalName"
]
# 判断是否获取到经销商关联医院信息
if
result
[
"data"
][
"list"
]:
# 生成随机数
hospital_random
=
random
.
randint
(
0
,
len
(
result
[
"data"
][
"list"
])
-
1
)
# 获取经销商关联医院信息
customerCode
=
result
[
"data"
][
"list"
][
hospital_random
][
"customerCode"
]
customerName
=
result
[
"data"
][
"list"
][
hospital_random
][
"customerName"
]
hospitalCode
=
result
[
"data"
][
"list"
][
hospital_random
][
"hospitalCode"
]
hospitalName
=
result
[
"data"
][
"list"
][
hospital_random
][
"hospitalName"
]
# 第三步进行列表查询
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url5"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload5"
,
customerCode
,
customerName
,
hospitalCode
,
hospitalName
)
# 第三步进行列表查询
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"url5"
)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload5"
,
customerCode
,
customerName
,
hospitalCode
,
hospitalName
)
"""
场景: 列表查询条件验证_经销商关联医院管理列表
用例名称:列表查询条件验证_经销商关联医院管理列表
输出:{"customerCode":"%s"}
"""
"""
场景: 列表查询条件验证_经销商关联医院管理列表
用例名称:列表查询条件验证_经销商关联医院管理列表
输出:{"customerCode":"%s"}
"""
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 发送请求
result
=
requests
.
get
(
url
,
params
=
request_body
,
headers
=
headers
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取经销商关联医院信息
result
=
json
.
loads
(
result
.
content
)
result
=
{
"customerCode"
:
result
[
"data"
][
"list"
][
0
][
"customerCode"
]}
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取经销商关联医院信息
result
=
json
.
loads
(
result
.
content
)
result
=
{
"customerCode"
:
result
[
"data"
][
"list"
][
0
][
"customerCode"
]}
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict5"
,
customerCode
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict5"
,
customerCode
)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc
().
check_result
(
check_dict
,
result
)
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