Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangjingdong
/
bihe_interface_test
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4a442bc2
authored
Jan 16, 2019
by
zhangjingdong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试
parent
05ef858b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
51 deletions
+51
-51
.idea/workspace.xml
+5
-5
碧合app/execute_automation_scripts.py
+46
-46
No files found.
.idea/workspace.xml
View file @
4a442bc2
...
...
@@ -13,7 +13,7 @@
</component>
<component
name=
"CoverageDataManager"
>
<SUITE
FILE_PATH=
"coverage/bihe_interface_test$hebin.coverage"
NAME=
"hebin Coverage Results"
MODIFIED=
"1547019882690"
SOURCE_PROVIDER=
"com.intellij.coverage.DefaultCoverageFileProvider"
RUNNER=
"coverage.py"
COVERAGE_BY_TEST_ENABLED=
"true"
COVERAGE_TRACING_ENABLED=
"false"
WORKING_DIRECTORY=
"$PROJECT_DIR$/碧合app"
/>
<SUITE
FILE_PATH=
"coverage/bihe_interface_test$execute_automation_scripts.coverage"
NAME=
"execute_automation_scripts Coverage Results"
MODIFIED=
"1547602
263469
"
SOURCE_PROVIDER=
"com.intellij.coverage.DefaultCoverageFileProvider"
RUNNER=
"coverage.py"
COVERAGE_BY_TEST_ENABLED=
"true"
COVERAGE_TRACING_ENABLED=
"false"
WORKING_DIRECTORY=
"$PROJECT_DIR$/碧合app"
/>
<SUITE
FILE_PATH=
"coverage/bihe_interface_test$execute_automation_scripts.coverage"
NAME=
"execute_automation_scripts Coverage Results"
MODIFIED=
"1547602
428268
"
SOURCE_PROVIDER=
"com.intellij.coverage.DefaultCoverageFileProvider"
RUNNER=
"coverage.py"
COVERAGE_BY_TEST_ENABLED=
"true"
COVERAGE_TRACING_ENABLED=
"false"
WORKING_DIRECTORY=
"$PROJECT_DIR$/碧合app"
/>
</component>
<component
name=
"FavoritesManager"
>
<favorites_list
name=
"bihe_interface_test"
/>
...
...
@@ -23,8 +23,8 @@
<file
leaf-file-name=
"execute_automation_scripts.py"
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/碧合app/execute_automation_scripts.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"3
8
1"
>
<caret
line=
"
51"
column=
"43"
selection-start-line=
"51"
selection-start-column=
"43"
selection-end-line=
"51"
selection-end-column=
"43
"
/>
<state
relative-caret-position=
"3
6
1"
>
<caret
line=
"
117"
column=
"19"
lean-forward=
"true"
selection-start-line=
"117"
selection-start-column=
"19"
selection-end-line=
"117"
selection-end-column=
"19
"
/>
<folding>
<element
signature=
"e#26#37#0"
expanded=
"true"
/>
</folding>
...
...
@@ -580,8 +580,8 @@
</entry>
<entry
file=
"file://$PROJECT_DIR$/碧合app/execute_automation_scripts.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"3
8
1"
>
<caret
line=
"
51"
column=
"43"
selection-start-line=
"51"
selection-start-column=
"43"
selection-end-line=
"51"
selection-end-column=
"43
"
/>
<state
relative-caret-position=
"3
6
1"
>
<caret
line=
"
117"
column=
"19"
lean-forward=
"true"
selection-start-line=
"117"
selection-start-column=
"19"
selection-end-line=
"117"
selection-end-column=
"19
"
/>
<folding>
<element
signature=
"e#26#37#0"
expanded=
"true"
/>
</folding>
...
...
碧合app/execute_automation_scripts.py
View file @
4a442bc2
# -*-
coding: utf-8 -*-
# -*-
coding: utf-8 -*-
...
...
@@ -49,9 +49,9 @@ class PostmanApi():
smtpObj
.
login
(
mail_user
,
mail_pass
)
smtpObj
.
sendmail
(
sender
,
receivers
,
message
.
as_string
())
smtpObj
.
quit
()
print
(
u"邮件发送成功"
)
.
encode
(
'ascii'
)
print
(
"pass"
)
except
smtplib
.
SMTPException
:
print
(
u"Error: 无法发送邮件"
)
.
encode
(
'ascii'
)
print
(
"failure"
)
return
True
def
post
(
self
):
...
...
@@ -71,49 +71,49 @@ class PostmanApi():
successful
=
0
failure
=
0
#
for p in path:
#
if os.path.isdir(p):
#
file.append(p)
#
for file_path in file:
#
# 当天日期
#
now_date = report_file + years
#
# 目前时分
#
now_module = now_date + "/" + at_the
#
# 文件完整路径
#
now_time = now_module + "/" + file_path + '.html'
#
execute = PostmanApi().full_path(
#
BASE_DIR, file_path, delay_request, timeout_request, now_time
#
)
#
#
if (os.path.exists(now_date)):
#
if (os.path.exists(now_module)):
#
os.system(execute)
#
else:
#
os.system("mkdir " + now_module)
#
os.system(execute)
#
else:
#
os.system("mkdir " + now_date)
#
if (os.path.exists(now_module)):
#
os.system(execute)
#
else:
#
os.system("mkdir " + now_module)
#
os.system(execute)
#
#
for item in os.listdir(extract_data):
#
if PostmanApi().endWith(item, '.html'):
#
# print(item)
#
with open(extract_data+"/"+item, 'rU') as strf:
#
str1 = strf.read()
#
res_2 = r'Test Scripts</div><div class="col-md-4">(.+?)</div><div class="col-md-4">(.+?)</div>'
#
pile1 =re.compile(res_2)
#
li = re.findall(pile1, str1)
#
li1 = str(li[0][0])
#
li2 = str(li[0][1])
#
successful += int(li[0][0])
#
failure += int(li[0][1])
#
report = ""
# report_text+=report.join(u" 模块:"+item[:-5]+" 数量:"+li1+
" 失败:"+li2+"\n")
# report_text1 = u" 接口数量:"+str(successful)+
" 失败数量:"+str(failure)
for
p
in
path
:
if
os
.
path
.
isdir
(
p
):
file
.
append
(
p
)
for
file_path
in
file
:
# 当天日期
now_date
=
report_file
+
years
# 目前时分
now_module
=
now_date
+
"/"
+
at_the
# 文件完整路径
now_time
=
now_module
+
"/"
+
file_path
+
'.html'
execute
=
PostmanApi
()
.
full_path
(
BASE_DIR
,
file_path
,
delay_request
,
timeout_request
,
now_time
)
if
(
os
.
path
.
exists
(
now_date
)):
if
(
os
.
path
.
exists
(
now_module
)):
os
.
system
(
execute
)
else
:
os
.
system
(
"mkdir "
+
now_module
)
os
.
system
(
execute
)
else
:
os
.
system
(
"mkdir "
+
now_date
)
if
(
os
.
path
.
exists
(
now_module
)):
os
.
system
(
execute
)
else
:
os
.
system
(
"mkdir "
+
now_module
)
os
.
system
(
execute
)
for
item
in
os
.
listdir
(
extract_data
):
if
PostmanApi
()
.
endWith
(
item
,
'.html'
):
# print(item)
with
open
(
extract_data
+
"/"
+
item
,
'rU'
)
as
strf
:
str1
=
strf
.
read
()
res_2
=
r'Test Scripts</div><div class="col-md-4">(.+?)</div><div class="col-md-4">(.+?)</div>'
pile1
=
re
.
compile
(
res_2
)
li
=
re
.
findall
(
pile1
,
str1
)
li1
=
str
(
li
[
0
][
0
])
li2
=
str
(
li
[
0
][
1
])
successful
+=
int
(
li
[
0
][
0
])
failure
+=
int
(
li
[
0
][
1
])
report
=
""
report_text
+=
report
.
join
(
u" 模块:"
+
item
[:
-
5
]
+
u" 数量:"
+
li1
+
u
" 失败:"
+
li2
+
"
\n
"
)
report_text1
=
u" 接口数量:"
+
str
(
successful
)
+
u
" 失败数量:"
+
str
(
failure
)
PostmanApi
()
.
report_mail
(
years
,
report_text1
,
report_text
,
at_the
,
report_file
)
return
self
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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