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-spd
Commits
1bde27c3
Commit
1bde27c3
authored
Mar 29, 2024
by
xiao-hesheng
Browse files
新增带量采购目录脚本
parent
1d14a724
Changes
12
Hide whitespace changes
Inline
Side-by-side
air_case/b3_herp3_purchase/a_k9_带量采购目录_列表查询_全部查询.air/a_k9_带量采购目录_列表查询_全部查询.py
View file @
1bde27c3
...
...
@@ -64,16 +64,30 @@ def test1():
# 将带量采购id存入文件中
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
id1
=
commonFuc
().
analysis_json
(
'id'
,
data1
)
#
print(type(data1), data1)
print
(
type
(
data1
),
data1
)
list_a
=
[]
list_b
=
[]
list_c
=
[]
list_a
.
append
(
id1
)
list_b
.
append
(
id1
)
list_c
.
append
(
id1
)
#
print('list_a', len(list_a), list_a)
print
(
'list_a'
,
len
(
list_a
),
list_a
)
info
=
(
list_a
,
list_b
,
list_c
)
titlename
=
(
'list_a'
,
'list_b'
,
'list_c'
)
# 将采购计划明细信息写入到文件中
# 将将带量采购id写入到文件中
FileUtils
().
w_info8
(
info
,
module
,
'带量采购目录信息'
,
titlename
,
'message7'
)
# data1 = commonFuc().analysis_json('data', data)
# # print(type(data1), data1)
# list_a = []
# list_b = []
# list_c = []
# list_a.append(data1[0])
# list_b.append(data1[1])
# list_c.append(data1[2])
# # print('list_a', len(list_a), list_a)
# info = (list_a, list_b, list_c)
# titlename = ('list_a', 'list_b', 'list_c')
# FileUtils().w_info8(info, module, '带量采购目录信息', titlename, 'message7')
test1
()
air_case/b3_herp3_purchase/a_l0_带量采购目录_添加明细_保存.air/a_l0_带量采购目录_添加明细_保存.py
0 → 100644
View file @
1bde27c3
# -*- encoding=utf8 -*-
from
common.db.sql.sql_del_branch_info
import
delData
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_l0_带量采购目录_添加明细_保存,id2297,id2297-110,sit,on
内网:a_l0_带量采购目录_添加明细_保存
"""
from
common.common_func
import
commonFuc
from
air_case.b1_herp3_login.登录内网系统.登录内网系统
import
login_system
from
airtest.core.api
import
using
import
sys
def
test1
():
module
=
"b3_herp3_purchase"
"""
场景:a_l0_带量采购目录_添加明细_保存
用例名称:a_l0_带量采购目录_添加明细_保存
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
#
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_vbp_addDetail_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
print
(
'headers'
,
headers
)
# 从文件中获取院区id
branchId
=
commonFuc
().
get_business_data
(
module
,
'branchId'
)
# # #获取日期
date1
=
timeUtils
().
get_time_hms
(
4
)
date2
=
timeUtils
().
get_time_hms
(
3
)
# print(date1,date2)
# a_l0_带量采购目录_添加明细_保存
# 从文件中获取产品名称
info
=
FileUtils
().
r_info8
(
module
,
"产品明细信息"
,
'message6'
)
print
(
'info'
,
info
)
list_b
=
info
[
'list_b'
]
print
(
'list_b'
,
list_b
)
hosGoodsCode
=
'hosGoodsCode'
goodsName
=
'goodsName'
goodsGeneralName
=
'goodsGeneralName'
goodsSpec
=
'goodsSpec'
goodsMfrsName
=
'goodsMfrsName'
hosGoodsId
=
'hosGoodsId'
goodsMfrsId
=
'goodsMfrsId'
for
i
in
list_b
:
hosGoodsCode
=
i
[
'hosGoodsCode'
]
goodsName
=
i
[
'goodsName'
]
goodsGeneralName
=
i
[
'goodsGeneralName'
]
goodsSpec
=
i
[
'goodsSpec'
]
goodsMfrsName
=
i
[
'goodsMfrsName'
]
hosGoodsId
=
i
[
'hosGoodsId'
]
goodsMfrsId
=
i
[
'goodsMfrsId'
]
break
#从文件获取带量采购目录id
info
=
FileUtils
().
r_info8
(
module
,
"带量采购目录信息"
,
'message7'
)
list2
=
info
[
'list_a'
]
id1
=
' '
.
join
(
list2
)
print
(
'bbbb'
,
id1
,
type
(
id1
))
# # 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload22_7"
,
hosGoodsId
,
hosGoodsCode
,
goodsMfrsId
,
id1
)
print
(
'request_body'
,
request_body
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
if
code
==
0
and
len
(
data
)
>=
1
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
test1
()
air_case/b3_herp3_purchase/a_l1_带量采购目录_明细行_停止.air/a_l1_带量采购目录_明细行_停止.py
0 → 100644
View file @
1bde27c3
# -*- encoding=utf8 -*-
from
common.db.sql.sql_del_branch_info
import
delData
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_l1_带量采购目录_明细行_停止,id2297,id2297-111,sit,on
内网:a_l1_带量采购目录_明细行_停止
"""
from
common.common_func
import
commonFuc
from
air_case.b1_herp3_login.登录内网系统.登录内网系统
import
login_system
from
airtest.core.api
import
using
import
sys
def
test1
():
module
=
"b3_herp3_purchase"
"""
场景:a_l1_带量采购目录_明细行_停止
用例名称:a_l1_带量采购目录_明细行_停止
输入:id
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
# 从文件获取带量采购目录id
info
=
FileUtils
().
r_info8
(
module
,
"带量采购目录信息"
,
'message7'
)
list2
=
info
[
'list_a'
]
id1
=
' '
.
join
(
list2
)
print
(
'bbbb'
,
id1
,
type
(
id1
))
# ======================================获取明细id=======================================
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_vbp_detailListVo_url"
)
url
=
url
+
id1
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
print
(
'headers'
,
headers
)
#get方式没有请求体
# 发送请求
result
=
commonFuc
().
http_get
(
url
,
headers
)
print
(
'result'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
id2
=
commonFuc
().
analysis_json
(
'id'
,
data
[
0
])
#======================================获取明细id=======================================
# 从文件中获取院区id
# branchId = commonFuc().get_business_data(module, 'branchId')
# # # #获取日期
# date1 = timeUtils().get_time_hms(4)
# date2 = timeUtils().get_time_hms(3)
# print(date1,date2)
# a_l1_带量采购目录_明细行_停止
# 从文件中获取产品名称
# info = FileUtils().r_info8(module, "产品明细信息", 'message6')
# print('info', info)
# list_b = info['list_b']
# print('list_b', list_b)
# hosGoodsCode = 'hosGoodsCode'
# goodsName = 'goodsName'
# goodsGeneralName = 'goodsGeneralName'
# goodsSpec = 'goodsSpec'
# goodsMfrsName = 'goodsMfrsName'
# hosGoodsId = 'hosGoodsId'
# goodsMfrsId = 'goodsMfrsId'
# for i in list_b:
# hosGoodsCode = i['hosGoodsCode']
# goodsName = i['goodsName']
# goodsGeneralName = i['goodsGeneralName']
# goodsSpec = i['goodsSpec']
# goodsMfrsName = i['goodsMfrsName']
# hosGoodsId = i['hosGoodsId']
# goodsMfrsId = i['goodsMfrsId']
# break
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_vbp_detailClose_url"
)
# # 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload22_8"
,
id2
)
print
(
'request_body'
,
request_body
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
if
code
==
0
and
data
==
True
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
test1
()
air_case/b3_herp3_purchase/a_l2_带量采购目录_关闭.air/a_l2_带量采购目录_关闭.py
0 → 100644
View file @
1bde27c3
# -*- encoding=utf8 -*-
from
common.db.sql.sql_del_branch_info
import
delData
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_l2_带量采购目录_关闭,id2297,id2297-112,sit,on
内网:a_l2_带量采购目录_关闭
"""
from
common.common_func
import
commonFuc
from
air_case.b1_herp3_login.登录内网系统.登录内网系统
import
login_system
from
airtest.core.api
import
using
import
sys
def
test1
():
module
=
"b3_herp3_purchase"
"""
场景:a_l2_带量采购目录_关闭
用例名称:a_l2_带量采购目录_关闭
输入:id
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
# 从文件获取带量采购目录id
info
=
FileUtils
().
r_info8
(
module
,
"带量采购目录信息"
,
'message7'
)
list2
=
info
[
'list_a'
]
id1
=
' '
.
join
(
list2
)
print
(
'bbbb'
,
id1
,
type
(
id1
))
# ======================================关闭带量项目=======================================
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_vbp_Close_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
print
(
'headers'
,
headers
)
# 发送请求
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload22_9"
,
id1
)
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
if
code
==
0
and
data
==
True
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
test1
()
air_case/b3_herp3_purchase/a_l3_带量采购目录_查看.air/a_l3_带量采购目录_查看.py
0 → 100644
View file @
1bde27c3
# -*- encoding=utf8 -*-
from
common.db.sql.sql_del_branch_info
import
delData
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_l3_带量采购目录_查看,id2297,id2297-113,sit,on
内网:a_l3_带量采购目录_查看
"""
from
common.common_func
import
commonFuc
from
air_case.b1_herp3_login.登录内网系统.登录内网系统
import
login_system
from
airtest.core.api
import
using
import
sys
def
test1
():
module
=
"b3_herp3_purchase"
"""
场景:a_l3_带量采购目录_查看
用例名称:a_l3_带量采购目录_查看
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
# 从文件获取带量采购目录id
info
=
FileUtils
().
r_info8
(
module
,
"带量采购目录信息"
,
'message7'
)
list2
=
info
[
'list_a'
]
id1
=
' '
.
join
(
list2
)
print
(
'bbbb'
,
id1
,
type
(
id1
))
# ======================================查看带量项目=======================================
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_vbp_getById_url"
)
url
=
url
+
id1
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
print
(
'headers'
,
headers
)
# 发送请求
result
=
commonFuc
().
http_get
(
url
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
projectName
=
commonFuc
().
analysis_json
(
'projectName'
,
data
)
if
code
==
0
and
len
(
data
)
>=
1
and
projectName
==
'自动化测试'
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
test1
()
air_case/b3_herp3_purchase/a_l4_带量采购目录_列表查询_条件查询_精确查询_项目名称.air/a_l4_带量采购目录_列表查询_条件查询_精确查询_项目名称.py
0 → 100644
View file @
1bde27c3
# -*- encoding=utf8 -*-
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_l4_带量采购目录_列表查询_条件查询_精确查询_项目名称,id2297,id2297-114,sit,on
内网:a_l4_带量采购目录_列表查询_条件查询_精确查询_项目名称
"""
from
common.common_func
import
commonFuc
from
air_case.b1_herp3_login.登录内网系统.登录内网系统
import
login_system
from
airtest.core.api
import
using
import
sys
def
test1
():
module
=
"b3_herp3_purchase"
"""
场景:a_l4_带量采购目录_列表查询_条件查询_精确查询_项目名称
用例名称:a_l4_带量采购目录_列表查询_条件查询_精确查询_项目名称
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
#
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_vbp_listPage_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
print
(
'headers'
,
headers
)
# 从文件中获取院区id
branchId
=
commonFuc
().
get_business_data
(
module
,
'branchId'
)
# # #获取日期
# date1=timeUtils().get_time_hms(2)
# date2=timeUtils().get_time_add(-1)
# print(date1,date2)
# a_l4_带量采购目录_列表查询_条件查询_精确查询_项目名称
projectname
=
commonFuc
().
get_business_data
(
module
,
"projectname"
)
# # 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload22_10"
,
projectname
)
print
(
'request_body'
,
request_body
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
data
)
if
code
==
0
and
total
==
1
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
test1
()
air_case/b3_herp3_purchase/a_l5_带量采购目录_列表查询_条件查询_精确查询_产品名称.air/a_l5_带量采购目录_列表查询_条件查询_精确查询_产品名称.py
0 → 100644
View file @
1bde27c3
# -*- encoding=utf8 -*-
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_l5_带量采购目录_列表查询_条件查询_精确查询_产品名称,id2297,id2297-115,sit,on
内网:a_l5_带量采购目录_列表查询_条件查询_精确查询_产品名称
"""
from
common.common_func
import
commonFuc
from
air_case.b1_herp3_login.登录内网系统.登录内网系统
import
login_system
from
airtest.core.api
import
using
import
sys
def
test1
():
module
=
"b3_herp3_purchase"
"""
场景:a_l5_带量采购目录_列表查询_条件查询_精确查询_产品名称
用例名称:a_l5_带量采购目录_列表查询_条件查询_精确查询_产品名称
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
#
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_vbp_listPage_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
print
(
'headers'
,
headers
)
# 从文件中获取院区id
branchId
=
commonFuc
().
get_business_data
(
module
,
'branchId'
)
# # #获取日期
# date1=timeUtils().get_time_hms(2)
# date2=timeUtils().get_time_add(-1)
# print(date1,date2)
# a_l5_带量采购目录_列表查询_条件查询_精确查询_产品名称
projectname
=
commonFuc
().
get_business_data
(
module
,
"projectname"
)
# 从文件中获取产品名称
info
=
FileUtils
().
r_info8
(
module
,
"产品明细信息"
,
'message6'
)
# print('info', info)
list_a
=
info
[
'list_a'
]
# print('list_a', list_a)
hosGoodsCode
=
'hosGoodsCode'
goodsName
=
'goodsName'
goodsGeneralName
=
'goodsGeneralName'
for
i
in
list_a
:
hosGoodsCode
=
i
[
'hosGoodsCode'
]
goodsName
=
i
[
'goodsName'
]
goodsGeneralName
=
i
[
'goodsGeneralName'
]
break
list2
=
[
hosGoodsCode
,
goodsName
,
goodsGeneralName
]
for
i
in
list2
:
# # 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload22_11"
,
projectname
,
i
)
print
(
'request_body'
,
request_body
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
data
)
if
code
==
0
and
total
==
1
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
test1
()
air_case/b3_herp3_purchase/a_l6_带量采购目录_列表查询_条件查询_精确查询_日期.air/a_l6_带量采购目录_列表查询_条件查询_精确查询_日期.py
0 → 100644
View file @
1bde27c3
# -*- encoding=utf8 -*-
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_l6_带量采购目录_列表查询_条件查询_精确查询_日期,id2297,id2297-116,sit,on
内网:a_l6_带量采购目录_列表查询_条件查询_精确查询_日期
"""
from
common.common_func
import
commonFuc
from
air_case.b1_herp3_login.登录内网系统.登录内网系统
import
login_system
from
airtest.core.api
import
using
import
sys
def
test1
():
module
=
"b3_herp3_purchase"
"""
场景:a_l6_带量采购目录_列表查询_条件查询_精确查询_日期
用例名称:a_l6_带量采购目录_列表查询_条件查询_精确查询_日期
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
#
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_vbp_listPage_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
print
(
'headers'
,
headers
)
# 从文件中获取院区id
branchId
=
commonFuc
().
get_business_data
(
module
,
'branchId'
)
# # #获取日期
# date1=timeUtils().get_time_hms(2)
# date2=timeUtils().get_time_add(-1)
# print(date1,date2)
# a_l6_带量采购目录_列表查询_条件查询_精确查询_日期
projectname
=
commonFuc
().
get_business_data
(
module
,
"projectname"
)
# 从文件中获取产品名称
info
=
FileUtils
().
r_info8
(
module
,
"产品明细信息"
,
'message6'
)
# print('info', info)
list_a
=
info
[
'list_a'
]
# print('list_a', list_a)
hosGoodsCode
=
'hosGoodsCode'
goodsName
=
'goodsName'
goodsGeneralName
=
'goodsGeneralName'
for
i
in
list_a
:
hosGoodsCode
=
i
[
'hosGoodsCode'
]
goodsName
=
i
[
'goodsName'
]
goodsGeneralName
=
i
[
'goodsGeneralName'
]
break
list2
=
[
hosGoodsCode
,
goodsName
,
goodsGeneralName
]
# # #获取日期
date1
=
timeUtils
().
get_time_hms
(
2
)
date2
=
timeUtils
().
get_time_add
(
1
)
for
i
in
list2
:
# # 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload22_12"
,
projectname
,
i
,
date1
,
date2
)
print
(
'request_body'
,
request_body
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
data
)
if
code
==
0
and
total
==
1
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
test1
()
air_case/b3_herp3_purchase/a_l7_带量采购目录_列表查询_条件查询_精确查询_计划状态.air/a_l7_带量采购目录_列表查询_条件查询_精确查询_计划状态.py
0 → 100644
View file @
1bde27c3
# -*- encoding=utf8 -*-
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_l7_带量采购目录_列表查询_条件查询_精确查询_计划状态,id2297,id2297-117,sit,on
内网:a_l7_带量采购目录_列表查询_条件查询_精确查询_计划状态
"""
from
common.common_func
import
commonFuc
from
air_case.b1_herp3_login.登录内网系统.登录内网系统
import
login_system
from
airtest.core.api
import
using
import
sys
def
test1
():
module
=
"b3_herp3_purchase"
"""
场景:a_l7_带量采购目录_列表查询_条件查询_精确查询_计划状态
用例名称:a_l7_带量采购目录_列表查询_条件查询_精确查询_计划状态
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username
=
commonFuc
().
get_business_data
(
module
,
"username"
)
# print('医院名称',username)
password
=
commonFuc
().
get_business_data
(
module
,
"password"
)
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
#
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_vbp_listPage_url"
)
print
(
url
)
# 获取请求头信息
headers
=
commonFuc
().
get_business_data
(
module
,
"json_headers2"
,
commonFuc
().
get_business_data
(
module
,
"json_contentType"
),
token
,
commonFuc
().
get_business_data
(
module
,
"X-APP-CODE"
))
print
(
'headers'
,
headers
)
# 从文件中获取院区id
branchId
=
commonFuc
().
get_business_data
(
module
,
'branchId'
)
# # #获取日期
# date1=timeUtils().get_time_hms(2)
# date2=timeUtils().get_time_add(-1)
# print(date1,date2)
# a_l7_带量采购目录_列表查询_条件查询_精确查询_计划状态
projectname
=
commonFuc
().
get_business_data
(
module
,
"projectname"
)
# 从文件中获取产品名称
info
=
FileUtils
().
r_info8
(
module
,
"产品明细信息"
,
'message6'
)
# print('info', info)
list_a
=
info
[
'list_a'
]
# print('list_a', list_a)
hosGoodsCode
=
'hosGoodsCode'
goodsName
=
'goodsName'
goodsGeneralName
=
'goodsGeneralName'
for
i
in
list_a
:
hosGoodsCode
=
i
[
'hosGoodsCode'
]
goodsName
=
i
[
'goodsName'
]
goodsGeneralName
=
i
[
'goodsGeneralName'
]
break
list2
=
[
hosGoodsCode
,
goodsName
,
goodsGeneralName
]
# # #获取日期
date1
=
timeUtils
().
get_time_hms
(
2
)
date2
=
timeUtils
().
get_time_add
(
1
)
for
i
in
list2
:
# # 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload22_13"
,
projectname
,
i
,
date1
,
date2
)
print
(
'request_body'
,
request_body
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
data
)
if
code
==
0
and
total
==
1
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
#以此选择计划状态进行查询
str
=
commonFuc
().
get_business_data
(
module
,
'status2'
)
list2
=
list
(
str
.
split
(
","
))
for
i
in
list2
:
# # 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload22_14"
,
i
)
print
(
'request_body'
,
request_body
)
# 发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
data
)
if
code
==
0
and
total
>=
0
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
test1
()
common/timeUtils.py
View file @
1bde27c3
...
...
@@ -2,29 +2,30 @@ from common.db.db import dbOP
import
datetime
from
datetime
import
timedelta
,
date
# 数据读入和写入文件
class
timeUtils
(
object
):
def
get_time_hms
(
self
,
type
=
1
):
def
get_time_hms
(
self
,
type
=
1
):
'''2023-05-06 09:39:30'''
import
time
if
type
==
1
:
if
type
==
1
:
t
=
time
.
strftime
(
"%Y-%m-%d %H:%M:%S"
,
time
.
localtime
())
return
t
elif
type
==
2
:
elif
type
==
2
:
t
=
time
.
strftime
(
"%Y-%m-%d 00:00:00"
,
time
.
localtime
())
return
t
elif
type
==
3
:
elif
type
==
3
:
t
=
time
.
strftime
(
"%Y-%m-%dT00:00:00.906Z"
,
time
.
localtime
())
return
t
elif
type
==
4
:
elif
type
==
4
:
one_day_in_seconds
=
60
*
60
*
24
tomorrow
=
time
.
localtime
(
time
.
time
()
+
one_day_in_seconds
)
t
=
time
.
strftime
(
"%Y-%m-%dT00:00:00.906Z"
,
tomorrow
)
t
=
time
.
strftime
(
"%Y-%m-%dT00:00:00.906Z"
,
tomorrow
)
return
t
def
get_time_add
(
self
,
days_aa
):
def
get_time_add
(
self
,
days_aa
):
import
time
# t = time.strftime("%Y-%m-%d", datetime.datetime.now())
t
=
(
date
.
today
()
+
timedelta
(
days
=
days_aa
)).
strftime
(
"%Y-%m-%d %H:%M:%S"
)
return
t
\ No newline at end of file
return
t
data/b3_herp3_purchase/data
View file @
1bde27c3
...
...
@@ -19,7 +19,11 @@
"herpService_basic_mcmsGoodsInfo_goodsPage_url": "/api/herpService/basic/mcmsGoodsInfo/goodsPage"
"herpService_vbp_edit_url": "/api/herpService/vbp/edit"
"herpService_vbp_listPage_url": "/api/herpService/vbp/listPage"
"herpService_vbp_addDetail_url": "/api/herpService/vbp/addDetail"
"herpService_vbp_detailListVo_url": "/api/herpService/vbp/detailListVo/"
"herpService_vbp_detailClose_url": "/api/herpService/vbp/detailClose"
"herpService_vbp_Close_url": "/api/herpService/vbp/close"
"herpService_vbp_getById_url": "/api/herpService/vbp/getById/"
data1: "10,20,60"
data2: "00001986,一次性医药包-低值,一次性医药包"
...
...
@@ -45,6 +49,8 @@ status2: "10,20,30,40"
"targetOrgId": "d69a68df361a4289b2262e4ef75b55a5"
"targetAreaId": "areah03470414"
"lc_name": "自动化测试22"
"projectname": "自动化测试"
json_contentType: "application/json"
json_headers: {
...
...
@@ -159,5 +165,14 @@ json_headers2: {
"payload22_4": {"queryObject":{},"pageNum":1,"pageSize":"%s"}
"payload22_5": {"detailList":[{"hosGoodsId":"%s","hosGoodsCode":"%s","goodsMfrsId":"%s"}],"remark":"自动化测试","goodsMfrsId":"%s","goodsMfrsName":"%s","planEndTime":"%s","planStartTime":"%s","projectName":"自动化测试","qty":"1","brand":"自动化测试"}
"payload22_6": {"pageNum":1,"pageSize":50,"queryObject":{"orderNo":"","goodsName":"","startTime":null,"endTime":null}}
"payload22_7": {"detailList":[{"hosGoodsId":"%s","hosGoodsCode":"%s","goodsMfrsId":"%s"}],"id":"%s","version":0}
"payload22_8": {"id":"%s","version":0}
"payload22_9": {"id":"%s","version":0}
"payload22_10": {"pageNum":1,"pageSize":50,"queryObject":{"orderNo":"","projectName":"%s","goodsName":"","startTime":null,"endTime":null}}
"payload22_11": {"pageNum":1,"pageSize":50,"queryObject":{"orderNo":"","projectName":"%s","goodsName":"%s","startTime":null,"endTime":null}}
"payload22_12": {"pageNum":1,"pageSize":50,"queryObject":{"orderNo":"","projectName":"%s","goodsName":"%s","startTime":"%s","endTime":"%s"}}
"payload22_13": {"pageNum":1,"pageSize":50,"queryObject":{"orderNo":"","projectName":"%s","goodsName":"%s","tbStatus":20,"startTime":"%s","endTime":"%s"}}
"payload22_14": {"pageNum":1,"pageSize":50,"queryObject":{"orderNo":"","projectName":"","goodsName":"","tbStatus":"%s","startTime":"","endTime":""}}
checkDict2: {"code": 0,'msg': None,'data':1}
report/summary.html
View file @
1bde27c3
...
...
@@ -56,7 +56,7 @@
<tr
width=
"600"
>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
0分
1
秒
</td>
<td
class=
'details-col-elapsed'
>
0分
5
秒
</td>
<td
class=
"details-col-elapsed"
>
100.0%
</td>
</tr>
</table>
...
...
@@ -72,9 +72,9 @@
</tr>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/a_
k8
_带量采购目录_
新增_保存
/log.html'
target=
'_blank'
>
a_
k8
_带量采购目录_
新增_保存
</a></td>
<td
class=
"details-col-elapsed"
><a
href=
'../log/a_
l7
_带量采购目录_
列表查询_条件查询_精确查询_计划状态
/log.html'
target=
'_blank'
>
a_
l7
_带量采购目录_
列表查询_条件查询_精确查询_计划状态
</a></td>
<td
class=
"success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
1.3
21
</td>
<td
class=
"details-col-elapsed"
>
5.
21
7
</td>
<td
class=
"details-col-elapsed"
>
xiaohesheng
</td>
</tr>
...
...
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