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
5214e01e
Commit
5214e01e
authored
Apr 11, 2024
by
xiao-hesheng
Browse files
优化脚本
parent
47bae5de
Changes
6
Hide whitespace changes
Inline
Side-by-side
air_case/b4_herp3_InitStock/a_c2_期初录入_列表_条件查询_精确查询_状态.air/a_c2_期初录入_列表_条件查询_精确查询_状态.py
View file @
5214e01e
...
...
@@ -66,10 +66,39 @@ def test1():
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
total
=
commonFuc
().
analysis_json
(
'total'
,
data
)
tbStatus
=
commonFuc
().
analysis_json
(
'tbStatus'
,
data
)
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
if
code
==
0
and
total
>=
1
and
str
(
tbStatus
)
==
i
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
if
i
==
"0"
:
# 未生成状态期初单号入文件
print
(
type
(
data1
),
data1
)
list_a
=
[]
list_b
=
[]
list_c
=
[]
list_a
.
append
(
data1
)
list_b
.
append
(
data1
)
list_c
.
append
(
data1
)
# 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
,
'message6'
)
elif
i
==
"1"
:
# 已生成状态期初单号写入文件
print
(
type
(
data1
),
data1
)
list_a
=
[]
list_b
=
[]
list_c
=
[]
list_a
.
append
(
data1
)
list_b
.
append
(
data1
)
list_c
.
append
(
data1
)
# 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/b4_herp3_InitStock/a_c5_期初录入_列表_条件查询_模糊查询_期初单号.air/a_c5_期初录入_列表_条件查询_模糊查询_期初单号.py
0 → 100644
View file @
5214e01e
# -*- encoding=utf8 -*-
from
common.db.sql.sql_get_info
import
sql_get_info
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_c5_期初录入_列表_条件查询_模糊查询_期初单号,id2301,id2301-25,sit,on
内网:a_c5_期初录入_列表_条件查询_模糊查询_期初单号
"""
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
=
"b4_herp3_InitStock"
"""
场景:a_c5_期初录入_列表_条件查询_模糊查询_期初单号
用例名称:a_c5_期初录入_列表_条件查询_模糊查询_期初单号
输入:无
输出:"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_mcmsInitStock_listVoPage_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
)
# 调用a_a1_期初录入_新增_低值生成一个期初单据
pro_path
=
commonFuc
().
get_pro_path
()
sys
.
path
.
append
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_a1_期初录入_新增_低值.air'
)
using
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_a1_期初录入_新增_低值.air'
)
from
a_a1_期初录入_新增_低值
import
test1
# 从文件读取期初单号_低值
info
=
FileUtils
().
r_info8
(
module
,
"期初单号信息"
,
'message1'
)
list_a
=
info
[
'list_a'
]
orderNo
=
'orderNo'
for
i
in
list_a
:
orderNo
=
i
[
'orderNo'
]
break
hospitalId
=
commonFuc
().
get_business_data
(
module
,
"hospitalId"
)
branchId
=
commonFuc
().
get_business_data
(
module
,
"branchId"
)
# str1 = commonFuc().get_business_data(module, 'status')
# list2 = list(str1.split(","))
# print(list2)
list2
=
commonFuc
().
get_str
(
orderNo
)
for
i
in
list2
:
# # 请求体
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload_12_3"
,
i
,
hospitalId
,
branchId
)
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
)
tbStatus
=
commonFuc
().
analysis_json
(
'tbStatus'
,
data
)
if
code
==
0
and
total
>=
1
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
test1
()
air_case/b4_herp3_InitStock/a_c6_期初录入_列表_删除.air/a_c6_期初录入_列表_删除.py
0 → 100644
View file @
5214e01e
# -*- encoding=utf8 -*-
from
common.db.sql.sql_get_info
import
sql_get_info
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_c6_期初录入_列表_删除,id2301,id2301-26,sit,on
内网:a_c6_期初录入_列表_删除
"""
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
=
"b4_herp3_InitStock"
"""
场景:a_c6_期初录入_列表_删除
用例名称:a_c6_期初录入_列表_删除
输入:无
输出:"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_mcmsInitStock_deleteById_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
)
# 调用a_a1_期初录入_新增_低值生成一个期初单据
pro_path
=
commonFuc
().
get_pro_path
()
sys
.
path
.
append
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_a1_期初录入_新增_低值.air'
)
using
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_a1_期初录入_新增_低值.air'
)
from
a_a1_期初录入_新增_低值
import
test1
pro_path
=
commonFuc
().
get_pro_path
()
sys
.
path
.
append
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_c2_期初录入_列表_条件查询_精确查询_状态.air'
)
using
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_c2_期初录入_列表_条件查询_精确查询_状态.air'
)
from
a_c2_期初录入_列表_条件查询_精确查询_状态
import
test1
# 从文件读取期初单号_未生成状态期初单号
info
=
FileUtils
().
r_info8
(
module
,
"未生成状态期初单号"
,
'message6'
)
list_a
=
info
[
'list_a'
]
list_a
=
','
.
join
(
map
(
str
,
list_a
))
print
(
'list_a'
,
list_a
)
import
json
new_request_body
=
list_a
.
replace
(
"'"
,
'"'
)
new_request_body1
=
new_request_body
.
replace
(
"None"
,
'null'
)
print
(
new_request_body1
)
list_a2
=
json
.
loads
(
new_request_body1
)
id1
=
'id'
for
i
in
list_a2
:
id1
=
i
[
'id'
]
break
url
=
url
+
id1
print
(
url
)
hospitalId
=
commonFuc
().
get_business_data
(
module
,
"hospitalId"
)
branchId
=
commonFuc
().
get_business_data
(
module
,
"branchId"
)
# str1 = commonFuc().get_business_data(module, 'status')
# list2 = list(str1.split(","))
# print(list2)
# 发送请求
result
=
commonFuc
().
http_delte
(
url
,
headers
)
print
(
'result'
,
result
)
# 断言
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
if
code
==
0
and
data
==
1
:
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
test1
()
air_case/b4_herp3_InitStock/a_c7_期初录入_低值_已生成单据_查看详情.air/a_c7_期初录入_低值_已生成单据_查看详情.py
0 → 100644
View file @
5214e01e
# -*- encoding=utf8 -*-
from
common.db.sql.sql_get_info
import
sql_get_info
from
common.fileUtls
import
FileUtils
from
common.timeUtils
import
timeUtils
__author__
=
"xiaohesheng"
"""
case_tag:api,herp-web,a_c7_期初录入_低值_已生成单据_查看详情,id2301,id2301-27,sit,on
内网:a_c7_期初录入_低值_已生成单据_查看详情
"""
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
=
"b4_herp3_InitStock"
"""
场景:a_c7_期初录入_低值_已生成单据_查看详情
用例名称:a_c7_期初录入_低值_已生成单据_查看详情
输入:无
输出:"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)
#
pro_path
=
commonFuc
().
get_pro_path
()
sys
.
path
.
append
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_c2_期初录入_列表_条件查询_精确查询_状态.air'
)
using
(
pro_path
+
r
'\\air_case\\b4_herp3_InitStock\\a_c2_期初录入_列表_条件查询_精确查询_状态.air'
)
from
a_c2_期初录入_列表_条件查询_精确查询_状态
import
test1
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"herpService_mcmsInitStock_getById_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
)
# 从文件读取期初单号_已生成状态期初单号
info
=
FileUtils
().
r_info8
(
module
,
"已生成状态期初单号"
,
'message7'
)
list_a
=
info
[
'list_a'
]
list_a
=
','
.
join
(
map
(
str
,
list_a
))
print
(
'list_a'
,
list_a
)
import
json
new_request_body
=
list_a
.
replace
(
"'"
,
'"'
)
new_request_body1
=
new_request_body
.
replace
(
"None"
,
'null'
)
print
(
new_request_body1
)
list_a2
=
json
.
loads
(
new_request_body1
)
id1
=
'id'
for
i
in
list_a2
:
id1
=
i
[
'id'
]
break
url
=
url
+
id1
print
(
url
)
# 发送请求
result
=
commonFuc
().
http_get
(
url
,
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
()
data/b4_herp3_InitStock/data
View file @
5214e01e
...
...
@@ -7,7 +7,7 @@
"herpService_mcmsInitStock_generate_url": "/api/herpService/mcmsInitStock/generate"
"herpService_mcmsInitStock_getInitStockDetails_url": "/api/herpService/mcmsInitStock/getInitStockDetails"
"herpService_mcmsInitStock_listVoPage_url": "/api/herpService/mcmsInitStock/listVoPage"
"herpService_mcmsInitStock_deleteById_url": "/api/herpService/mcmsInitStock/deleteById/"
status: "0,1"
data1: "10,20,60"
...
...
report/summary.html
View file @
5214e01e
...
...
@@ -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分
2
秒
</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_c
4
_期初录入_
列表_条件查询_精确查询_耗材类型
/log.html'
target=
'_blank'
>
a_c
4
_期初录入_
列表_条件查询_精确查询_耗材类型
</a></td>
<td
class=
"details-col-elapsed"
><a
href=
'../log/a_c
7
_期初录入_
低值_已生成单据_查看详情
/log.html'
target=
'_blank'
>
a_c
7
_期初录入_
低值_已生成单据_查看详情
</a></td>
<td
class=
"success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
1.31
</td>
<td
class=
"details-col-elapsed"
>
2.076
</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