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-sc
Commits
6c225100
Commit
6c225100
authored
Nov 22, 2023
by
17322369953
Browse files
air报告推送
parent
16c3516a
Changes
24
Hide whitespace changes
Inline
Side-by-side
common/fileUtls.py
0 → 100644
View file @
6c225100
import
os
from
ruamel
import
yaml
from
common.db.db
import
dbOP
import
datetime
curpath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
rootPath
=
os
.
path
.
split
(
curpath
)[
0
]
# 数据读入和写入文件
class
FileUtils
(
object
):
def
w_info
(
self
,
info
,
keyname
):
module
=
info
[
2
]
dict
=
{}
value
=
{}
value
[
'username'
]
=
info
[
0
]
value
[
'goodsname'
]
=
info
[
1
]
key
=
keyname
dict
[
key
]
=
value
w_path
=
rootPath
+
os
.
sep
+
'data'
+
os
.
sep
+
module
# print(w_path)
yamlpath
=
os
.
path
.
join
(
w_path
,
"message"
)
# 写入到yaml文件
with
open
(
yamlpath
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
yaml
.
dump
(
dict
,
f
,
Dumper
=
yaml
.
RoundTripDumper
,
allow_unicode
=
True
)
def
r_info
(
self
,
module
,
keyname
):
w_path
=
rootPath
+
os
.
sep
+
'data'
+
os
.
sep
+
module
yamlpath
=
os
.
path
.
join
(
w_path
,
"message"
)
file_value
=
open
(
yamlpath
,
'r'
,
encoding
=
'utf-8'
)
result
=
yaml
.
load
(
file_value
.
read
(),
Loader
=
yaml
.
Loader
)
if
result
is
not
None
:
key
=
keyname
if
key
in
result
:
return
result
[
key
]
else
:
return
None
else
:
return
None
#供货关系信息写入文件
def
w_info1
(
self
,
info
,
module
,
keyname
):
module
=
module
dict
=
{}
value
=
{}
value
[
'e_corpId'
]
=
info
[
0
]
value
[
'h_corpId'
]
=
info
[
1
]
value
[
'e_username'
]
=
info
[
2
]
value
[
'h_name'
]
=
info
[
3
]
key
=
keyname
dict
[
key
]
=
value
w_path
=
rootPath
+
os
.
sep
+
'data'
+
os
.
sep
+
module
# print(w_path)
yamlpath
=
os
.
path
.
join
(
w_path
,
"message"
)
# 写入到yaml文件
with
open
(
yamlpath
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
yaml
.
dump
(
dict
,
f
,
Dumper
=
yaml
.
RoundTripDumper
,
allow_unicode
=
True
)
#写入院区数据,新函数,存在已有内容,替换掉旧内容
def
w_info2_new
(
self
,
newinfo
,
module
,
keyname
,
oldinfo
):
module
=
module
dict
=
{}
value
=
{}
value
[
'branch_id'
]
=
newinfo
[
0
]
value
[
'branch_name'
]
=
newinfo
[
1
]
key
=
keyname
dict
[
key
]
=
value
w_path
=
rootPath
+
os
.
sep
+
'data'
+
os
.
sep
+
module
# print(w_path)
yamlpath
=
os
.
path
.
join
(
w_path
,
"message"
)
if
(
self
.
r_info
(
module
,
keyname
)
!=
None
):
# 替换文件内容
file
=
open
(
yamlpath
,
"r+"
,
encoding
=
"utf-8"
)
content
=
file
.
read
()
for
i
in
range
(
len
(
newinfo
)):
new_content
=
content
.
replace
(
oldinfo
[
i
],
newinfo
[
i
])
file
.
seek
(
0
)
file
.
write
(
new_content
)
file
.
close
()
else
:
# 写入到yaml文件
with
open
(
yamlpath
,
"a"
,
encoding
=
"utf-8"
)
as
f
:
yaml
.
dump
(
dict
,
f
,
Dumper
=
yaml
.
RoundTripDumper
,
allow_unicode
=
True
)
#写入院区数据
def
w_info2
(
self
,
info
,
module
,
keyname
):
module
=
module
dict
=
{}
value
=
{}
value
[
'branch_id'
]
=
info
[
0
]
value
[
'branch_name'
]
=
info
[
1
]
key
=
keyname
dict
[
key
]
=
value
w_path
=
rootPath
+
os
.
sep
+
'data'
+
os
.
sep
+
module
# print(w_path)
yamlpath
=
os
.
path
.
join
(
w_path
,
"message"
)
if
(
self
.
r_info
(
module
,
keyname
)
!=
None
):
# 写入到yaml文件
with
open
(
yamlpath
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
yaml
.
dump
(
dict
,
f
,
Dumper
=
yaml
.
RoundTripDumper
,
allow_unicode
=
True
)
else
:
# 写入到yaml文件
with
open
(
yamlpath
,
"a"
,
encoding
=
"utf-8"
)
as
f
:
yaml
.
dump
(
dict
,
f
,
Dumper
=
yaml
.
RoundTripDumper
,
allow_unicode
=
True
)
#写入公告id和公告标题
def
w_info3
(
self
,
info
,
module
,
keyname
):
module
=
module
dict
=
{}
value
=
{}
value
[
'notices_id'
]
=
info
[
0
]
value
[
'notices_name'
]
=
info
[
1
]
key
=
keyname
dict
[
key
]
=
value
w_path
=
rootPath
+
os
.
sep
+
'data'
+
os
.
sep
+
module
# print(w_path)
yamlpath
=
os
.
path
.
join
(
w_path
,
"message1"
)
# 写入到yaml文件
with
open
(
yamlpath
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
yaml
.
dump
(
dict
,
f
,
Dumper
=
yaml
.
RoundTripDumper
,
allow_unicode
=
True
)
#读取公告id和标题
def
r_info3
(
self
,
module
,
keyname
):
w_path
=
rootPath
+
os
.
sep
+
'data'
+
os
.
sep
+
module
yamlpath
=
os
.
path
.
join
(
w_path
,
"message1"
)
file_value
=
open
(
yamlpath
,
'r'
,
encoding
=
'utf-8'
)
result
=
yaml
.
load
(
file_value
.
read
(),
Loader
=
yaml
.
Loader
)
if
result
is
not
None
:
key
=
keyname
if
key
in
result
:
return
result
[
key
]
else
:
return
None
else
:
return
None
#写入科室信息
def
w_info4
(
self
,
info
,
module
,
keyname
,
titlename
):
module
=
module
dict
=
{}
value
=
{}
for
i
in
range
(
len
(
titlename
)):
value
[
titlename
[
i
]]
=
info
[
i
]
# value[titlename[0]] = info[0]
# value[titlename[1]] = info[1]
key
=
keyname
dict
[
key
]
=
value
w_path
=
rootPath
+
os
.
sep
+
'data'
+
os
.
sep
+
module
# print(w_path)
yamlpath
=
os
.
path
.
join
(
w_path
,
"message"
)
if
(
self
.
r_info
(
module
,
keyname
)
!=
None
):
print
(
'已有相同信息,不写入'
)
# 写入到yaml文件
# with open(yamlpath, "w", encoding="utf-8") as f:
# yaml.dump(dict, f, Dumper=yaml.RoundTripDumper,allow_unicode=True)
else
:
# 写入到yaml文件
with
open
(
yamlpath
,
"a"
,
encoding
=
"utf-8"
)
as
f
:
yaml
.
dump
(
dict
,
f
,
Dumper
=
yaml
.
RoundTripDumper
,
allow_unicode
=
True
)
if
__name__
==
'__main__'
:
# info=("aaaa","bbbbbb","mdm3-pim")
# FileUtils().w_info(info,"产品新增")
aa
=
FileUtils
().
r_info
(
"mdm3-pim"
,
"产品新增"
)
print
(
aa
[
'username'
])
common/run_case_conditions.py
View file @
6c225100
...
@@ -8,6 +8,7 @@ import io
...
@@ -8,6 +8,7 @@ import io
import
time
import
time
import
re
import
re
import
report.report.report
as
report
import
report.report.report
as
report
import
logging
import
logging
from
airtest.utils.logger
import
get_logger
from
airtest.utils.logger
import
get_logger
from
multiprocessing
import
Pool
from
multiprocessing
import
Pool
...
...
report/summary.html
View file @
6c225100
...
@@ -54,10 +54,10 @@
...
@@ -54,10 +54,10 @@
</tr>
</tr>
<tr
width=
"600"
>
<tr
width=
"600"
>
<td
class=
'details-col-elapsed'
>
1
</td>
<td
class=
'details-col-elapsed'
>
6
</td>
<td
class=
'details-col-elapsed'
>
0
</td>
<td
class=
'details-col-elapsed'
>
6
</td>
<td
class=
'details-col-elapsed'
>
0分8
秒
</td>
<td
class=
'details-col-elapsed'
>
1分5
秒
</td>
<td
class=
"details-col-elapsed"
>
0.0%
</td>
<td
class=
"details-col-elapsed"
>
10
0.0%
</td>
</tr>
</tr>
</table>
</table>
...
@@ -72,10 +72,45 @@
...
@@ -72,10 +72,45 @@
</tr>
</tr>
<tr
width=
"600"
>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/baidu/log.html'
target=
'_blank'
>
baidu
</a></td>
<td
class=
"details-col-elapsed"
><a
href=
'../log/case_login_no_input_userid/log.html'
target=
'_blank'
>
case_login_no_input_userid
</a></td>
<td
class=
"fail"
>
失败
</td>
<td
class=
"success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
8.554
</td>
<td
class=
"details-col-elapsed"
>
10.549
</td>
<td
class=
"details-col-elapsed"
>
Administrator
</td>
<td
class=
"details-col-elapsed"
>
Unknown
</td>
</tr>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/case_login_no_input_verifycode/log.html'
target=
'_blank'
>
case_login_no_input_verifycode
</a></td>
<td
class=
"success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
9.908
</td>
<td
class=
"details-col-elapsed"
>
Unknown
</td>
</tr>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/case_login_password_error/log.html'
target=
'_blank'
>
case_login_password_error
</a></td>
<td
class=
"success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
9.955
</td>
<td
class=
"details-col-elapsed"
>
Unknown
</td>
</tr>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/case_login_success/log.html'
target=
'_blank'
>
case_login_success
</a></td>
<td
class=
"success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
9.955
</td>
<td
class=
"details-col-elapsed"
>
Unknown
</td>
</tr>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/case_login_userid_error/log.html'
target=
'_blank'
>
case_login_userid_error
</a></td>
<td
class=
"success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
10.563
</td>
<td
class=
"details-col-elapsed"
>
Unknown
</td>
</tr>
<tr
width=
"600"
>
<td
class=
"details-col-elapsed"
><a
href=
'../log/case_login_verify_code_error/log.html'
target=
'_blank'
>
case_login_verify_code_error
</a></td>
<td
class=
"success"
>
成功
</td>
<td
class=
"details-col-elapsed"
>
9.981
</td>
<td
class=
"details-col-elapsed"
>
Unknown
</td>
</tr>
</tr>
</table>
</table>
...
...
runner.py
View file @
6c225100
...
@@ -11,7 +11,6 @@ sys.path.append(rootPath)
...
@@ -11,7 +11,6 @@ sys.path.append(rootPath)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
# python .\runner.py tag baidu debug sit
# 第一个参数 case 执行类型,'all', 'sc', 'tag'
# 第一个参数 case 执行类型,'all', 'sc', 'tag'
caseType
=
sys
.
argv
[
1
]
caseType
=
sys
.
argv
[
1
]
# 第2个参数要执行
# 第2个参数要执行
...
...
Prev
1
2
Next
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