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
ca9fca31
Commit
ca9fca31
authored
Mar 14, 2024
by
xiao-hesheng
Browse files
优化脚本
parent
d43cece9
Changes
8
Hide whitespace changes
Inline
Side-by-side
air_case/b2_herp3_bs/c3_新增科室_特殊科室_二级库房.air/c3_新增科室_特殊科室_二级库房.py
View file @
ca9fca31
...
@@ -7,8 +7,8 @@ from common.timeUtils import timeUtils
...
@@ -7,8 +7,8 @@ from common.timeUtils import timeUtils
__author__
=
"xiaohesheng"
__author__
=
"xiaohesheng"
"""
"""
case_tag:api,herp-web,c
0
_新增科室_特殊科室_
设备科_中心
库房,id2263,id2263-23,sit,on
case_tag:api,herp-web,c
3
_新增科室_特殊科室_
二级
库房,id2263,id2263-23,sit,on
主数据平台:c
0
_新增科室_特殊科室_
设备科_中心
库房
主数据平台:c
3
_新增科室_特殊科室_
二级
库房
"""
"""
from
common.common_func
import
commonFuc
from
common.common_func
import
commonFuc
...
@@ -17,8 +17,8 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_
...
@@ -17,8 +17,8 @@ from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_
module
=
"b2_herp3_bs"
module
=
"b2_herp3_bs"
def
add_center_dept
():
def
add_center_dept
():
"""
"""
场景:c
0
_新增科室_特殊科室_
设备科_中心
库房
场景:c
3
_新增科室_特殊科室_
二级
库房
用例名称:c
0
_新增科室_特殊科室_
设备科_中心
库房
用例名称:c
3
_新增科室_特殊科室_
二级
库房
输入:无
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
"""
...
@@ -30,7 +30,7 @@ def add_center_dept():
...
@@ -30,7 +30,7 @@ def add_center_dept():
# 获取token和projectCode
# 获取token和projectCode
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
token
,
projectCode
,
uxid
,
corpId
,
info
=
login_system
(
username
,
password
).
get_token
()
# print( token,projectCode,uxid,corpId,info)
# print( token,projectCode,uxid,corpId,info)
#c
0
_新增科室_特殊科室_
设备科_中心
库房
#c
3
_新增科室_特殊科室_
二级
库房
branch_id
=
FileUtils
().
r_info
(
module
,
'院区新增'
)[
"branch_id"
]
branch_id
=
FileUtils
().
r_info
(
module
,
'院区新增'
)[
"branch_id"
]
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"dept_insert_url"
)
url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"dept_insert_url"
)
...
...
air_case/b2_herp3_bs/o5科室管理_科室产品分配_添加科室产品页面_查询全部.air/o5科室管理_科室产品分配_添加科室产品页面_查询全部.py
View file @
ca9fca31
...
@@ -78,5 +78,18 @@ def test1():
...
@@ -78,5 +78,18 @@ def test1():
else
:
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
commonFuc
().
check_text_exist
(
'error'
,
result
)
#分别返回三个产品,高值,低值,试剂
# list1=[]
# data1=commonFuc().analysis_json('data', data)
# for i in data1:
# purMode=commonFuc().analysis_json('purMode', i)
# if purMode==10:
# list1.append(i)
# continue
# elif purMode==20:
# list1.append(i)
# continue
# elif purMode==60:
test1
()
test1
()
air_case/b2_herp3_bs/o6科室管理_科室产品分配_添加科室产品页面_条件查询.air/o6科室管理_科室产品分配_添加科室产品页面_条件查询.py
View file @
ca9fca31
...
@@ -98,24 +98,24 @@ def test1():
...
@@ -98,24 +98,24 @@ def test1():
commonFuc
().
check_text_exist
(
0
,
result
)
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
else
:
commonFuc
().
check_text_exist
(
'error'
,
result
)
commonFuc
().
check_text_exist
(
'error'
,
result
)
#检验试剂
#检验试剂
(2024.3.14因产品数据问题,添加页面查不出试剂)
request_body
=
commonFuc
().
get_business_data
(
module
,
"payload58_5"
,
dept2_id
)
#
request_body = commonFuc().get_business_data(module, "payload58_5", dept2_id)
# # # 发送请求
# # #
#
发送请求
result
=
commonFuc
().
http_post
(
url
,
request_body
,
headers
)
#
result = commonFuc().http_post(url, request_body, headers)
print
(
'resultaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
result
)
#
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言
#
#
断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
#
#
checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
#
#
commonFuc().check_result(checkDict,result)
code
=
commonFuc
().
analysis_json
(
'code'
,
result
)
#
code = commonFuc().analysis_json('code', result)
data
=
commonFuc
().
analysis_json
(
'data'
,
result
)
#
data = commonFuc().analysis_json('data', result)
total
=
commonFuc
().
analysis_json
(
'total'
,
data
)
#
total = commonFuc().analysis_json('total', data)
data
=
commonFuc
().
analysis_json
(
'data'
,
data
)
#
data = commonFuc().analysis_json('data', data)
goodsName
=
commonFuc
().
analysis_json
(
'goodsName'
,
data
)
#
goodsName = commonFuc().analysis_json('goodsName', data)
# print(pageSize)
#
#
print(pageSize)
if
code
==
0
and
total
>=
1
:
#
if code == 0 and total >= 1:
commonFuc
().
check_text_exist
(
0
,
result
)
#
commonFuc().check_text_exist(0, result)
else
:
#
else:
commonFuc
().
check_text_exist
(
'error'
,
result
)
#
commonFuc().check_text_exist('error', result)
test1
()
test1
()
air_case/b2_herp3_bs/r_b8库房管理_库区设置_同步库房信息.air/r_b8库房管理_库区设置_同步库房信息.py
View file @
ca9fca31
...
@@ -80,7 +80,7 @@ def test1():
...
@@ -80,7 +80,7 @@ def test1():
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
data1
=
commonFuc
().
analysis_json
(
'data'
,
data
)
# pageSize = commonFuc().analysis_json('pageSize', data)
# pageSize = commonFuc().analysis_json('pageSize', data)
# print(pageSize, type(pageSize))
# print(pageSize, type(pageSize))
if
code
==
0
and
data
=
=
1
:
if
code
==
0
and
data
>
=
1
:
commonFuc
().
check_text_exist
(
0
,
result
)
commonFuc
().
check_text_exist
(
0
,
result
)
else
:
else
:
print
(
'error'
,
result
)
print
(
'error'
,
result
)
...
...
data/b2_herp3_bs/message
View file @
ca9fca31
院区新增:
院区新增:
branch_id: h0347-33
59
branch_id: h0347-33
81
branch_name: 东土城路院区
c#YBu
branch_name: 东土城路院区
taKz9
科室信息:
科室信息:
dept2_id: 9
6c4d23bff8541599eb1a7f5f813e421
dept2_id: 9
9a756f1898841a985a48a0658b130a7
dept2_name: 二级科室002
dept2_name: 二级科室002
单元包信息:
branchGoodsId: h0347-337500000010
hosGoodsId: h034700000010
data/b2_herp3_bs/message1
View file @
ca9fca31
公告新增
:
公告新增
:
notices_id
:
N0017
34
-h0347
notices_id
:
N0017
82
-h0347
notices_name
:
notices_name
:
用户名信息
:
username1
:
LHw!K
username2
:
LHw!K
report/summary.html
View file @
ca9fca31
...
@@ -55,9 +55,9 @@
...
@@ -55,9 +55,9 @@
<tr
width=
"600"
>
<tr
width=
"600"
>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
0
</td>
<td
class=
'details-col-elapsed'
>
0分
2
秒
</td>
<td
class=
'details-col-elapsed'
>
0分
8
秒
</td>
<td
class=
"details-col-elapsed"
>
10
0.0%
</td>
<td
class=
"details-col-elapsed"
>
0.0%
</td>
</tr>
</tr>
</table>
</table>
...
@@ -72,9 +72,9 @@
...
@@ -72,9 +72,9 @@
</tr>
</tr>
<tr
width=
"600"
>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/
p1科室管理_科室产品分配_产品列表查询
/log.html'
target=
'_blank'
>
p1科室管理_科室产品分配_产品列表查询
</a></td>
<td
class=
"details-col-elapsed"
><a
href=
'../log/
r_b8库房管理_库区设置_同步库房信息
/log.html'
target=
'_blank'
>
r_b8库房管理_库区设置_同步库房信息
</a></td>
<td
class=
"
success"
>
成功
</td>
<td
class=
"
fail"
>
失败
</td>
<td
class=
"details-col-elapsed"
>
2.128
</td>
<td
class=
"details-col-elapsed"
>
8.049
</td>
<td
class=
"details-col-elapsed"
>
xiaohesheng
</td>
<td
class=
"details-col-elapsed"
>
xiaohesheng
</td>
</tr>
</tr>
...
...
runner_test.py
0 → 100644
View file @
ca9fca31
# -*- encoding=utf8 -*-
import
os
import
sys
import
platform
import
shutil
import
common.run_case_conditions
as
run
import
common.case_tag_get
as
case_tag_get
from
common.db.sql.sql_del_branch_info
import
delData
curPath
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
rootPath
=
os
.
path
.
split
(
curPath
)[
0
]
sys
.
path
.
append
(
rootPath
)
if
__name__
==
'__main__'
:
# 第一个参数 case 执行类型,'all', 'sc', 'tag'
caseType
=
sys
.
argv
[
1
]
# 第2个参数要执行
# 第3个参数,设置日志等级的caseName, 多个文件逗号分割
caseName
=
sys
.
argv
[
2
]
log_level
=
sys
.
argv
[
3
]
log_level
=
log_level
.
lower
()
#获取运行环境,写入环境变量
env
=
sys
.
argv
[
4
]
os
.
environ
[
'ENV'
]
=
env
.
lower
()
job_url
=
""
#判断传入过来的参数数量是否>5个,如果>5,则传过来的第5个参数为job链接
if
len
(
sys
.
argv
)
>
5
:
job_url
=
sys
.
argv
[
5
]
#复制hosts文件
if
platform
.
system
()
==
'Windows'
:
cmd
=
"xcopy /s /y data\hosts C:\Windows\System32\drivers\etc\ "
else
:
cmd
=
'mv data/hosts /etc/'
os
.
system
(
cmd
)
workspace
=
os
.
path
.
abspath
(
"."
)
case_path
=
os
.
path
.
join
(
workspace
,
'air_case'
)
log_path
=
os
.
path
.
join
(
workspace
,
'log'
)
runtime_log
=
os
.
path
.
join
(
log_path
,
'runtime.txt'
)
if
not
os
.
path
.
exists
(
log_path
):
os
.
makedirs
(
'log'
)
if
not
os
.
path
.
exists
(
runtime_log
):
os
.
system
(
'type nul >log/run_time.txt'
)
print
(
"workspace: "
+
workspace
)
print
(
"air_case_path: "
+
case_path
)
print
(
"air_log_path: "
+
log_path
)
print
(
"caseType:"
+
caseType
)
test
=
run
.
CustomAirTestCase
(
workspace
,
case_path
,
log_path
,
runtime_log
,
log_level
)
try
:
if
caseType
==
'sc'
:
moduleName
=
sys
.
argv
[
2
]
caseName
=
sys
.
argv
[
3
]
sceName
=
sys
.
argv
[
4
]
log_level
=
sys
.
argv
[
5
]
log_level
=
log_level
.
lower
()
# 获取运行环境,写入环境变量
env
=
sys
.
argv
[
6
]
os
.
environ
[
'ENV'
]
=
env
.
lower
()
test
.
run_by_scenario
(
moduleName
,
caseName
,
sceName
)
else
:
case_list
=
caseName
.
split
(
','
)
if
caseType
==
'tag'
:
tag
=
sys
.
argv
[
2
]
case_list
=
case_tag_get
.
get_case_tag_list
(
case_path
,
tag
)
run_case
,
case_list
,
case_scenario_name
=
test
.
merge_new_file
(
case_list
)
test
.
run_case
(
run_case
,
case_list
,
job_url
,
case_scenario_name
)
except
Exception
as
e
:
print
(
"Exception:"
,
e
)
finally
:
"""
检查air_case中是否有多余的.py文件和场景文件,有就删除
"""
dir_list
=
os
.
listdir
(
case_path
)
for
cur_file
in
dir_list
:
path
=
os
.
path
.
join
(
case_path
,
cur_file
)
if
os
.
path
.
isdir
(
path
):
file_list
=
os
.
listdir
(
path
)
for
file
in
file_list
:
file_path
=
os
.
path
.
join
(
path
,
file
)
if
os
.
path
.
isfile
(
file_path
):
os
.
remove
(
file_path
)
print
(
'删了什么文件'
,
file_path
)
else
:
if
str
(
file
).
startswith
(
"场景"
):
name
=
str
(
file
).
replace
(
".air"
,
""
)
del_file
=
os
.
path
.
join
(
file_path
,
name
+
".py"
)
if
os
.
path
.
exists
(
del_file
):
os
.
remove
(
del_file
)
shutil
.
rmtree
(
file_path
)
print
(
'删了什么文件'
,
del_file
)
# #删除自动化脚本产生的数据
# delData().Delete_branch_by_id()
# delData().Delete_goods_change_info()
# delData().Delete_probeInfo_other()
# print('结束了')
\ No newline at end of file
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