Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
Test
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曹燕
Test
Commits
0db045b0
Commit
0db045b0
authored
Nov 25, 2019
by
huangqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加发送邮件
parent
ac4e868b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
13 deletions
+22
-13
common.py
Interface_Atuo_test/jiyunying/common.py
+1
-2
config.conf
Interface_Atuo_test/jiyunying/config.conf
+7
-3
dingdingmessage.py
Interface_Atuo_test/jiyunying/dingdingmessage.py
+4
-3
run.py
Interface_Atuo_test/jiyunying/run.py
+10
-5
No files found.
Interface_Atuo_test/jiyunying/common.py
View file @
0db045b0
...
@@ -34,7 +34,6 @@ def update_address(address: list):
...
@@ -34,7 +34,6 @@ def update_address(address: list):
print
(
"未输入IP地址,使用默认IP地址"
)
print
(
"未输入IP地址,使用默认IP地址"
)
# 获取时间格式名称
# 获取时间格式名称
def
get_time_name
()
->
list
:
def
get_time_name
()
->
list
:
names
=
[]
names
=
[]
...
@@ -61,7 +60,7 @@ def readconf(section, option):
...
@@ -61,7 +60,7 @@ def readconf(section, option):
def
get_case_path
(
section
):
def
get_case_path
(
section
):
values
=
[]
values
=
[]
cf
=
configparser
.
ConfigParser
()
cf
=
configparser
.
ConfigParser
()
cf
.
read
(
"
config
.conf"
,
encoding
=
"utf-8"
)
cf
.
read
(
"
run
.conf"
,
encoding
=
"utf-8"
)
if
cf
.
has_section
(
section
):
if
cf
.
has_section
(
section
):
items
=
cf
.
items
(
section
)
items
=
cf
.
items
(
section
)
for
item
in
items
:
for
item
in
items
:
...
...
Interface_Atuo_test/jiyunying/config.conf
View file @
0db045b0
...
@@ -9,7 +9,7 @@ reportpath = report/
...
@@ -9,7 +9,7 @@ reportpath = report/
web_hook
=
https
://
oapi
.
dingtalk
.
com
/
robot
/
send
?
access_token
=
94
b76afb5b538437e9986e95bd9e4c882cfcf3c75e8c1b3a6f209cac403b8e00
web_hook
=
https
://
oapi
.
dingtalk
.
com
/
robot
/
send
?
access_token
=
94
b76afb5b538437e9986e95bd9e4c882cfcf3c75e8c1b3a6f209cac403b8e00
[
token
]
[
token
]
token
=
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9
.
eyJ1aWQiOiIyNTc0ODgiLCJ0ZXJtaW5hbCI6InBjIiwidXVpZCI6Ij
g2OTE0YzkzNDQwYjQ5OTE5NGNkOGZiNTI4NTE2MWQ3IiwidGltZXN0YW1wIjoxNTc0NDA4NjQ3MDIwfQ
.
zT32vh1ZIc7iwKnZAaS452
-
oyMjQB5JUAhTeyCo9PFM
token
=
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9
.
eyJ1aWQiOiIyNTc0ODgiLCJ0ZXJtaW5hbCI6InBjIiwidXVpZCI6Ij
IwNDFlZmNjNWNmZjRlNTlhZTkzNWY0YjhkODQ3MzhlIiwidGltZXN0YW1wIjoxNTc0NjY2NjQwODU3fQ
.
_
G5B9sI238xlT6sAkJ3ou15Qj3HXUIleF4UhJ48YdeY
[
password
]
[
password
]
wan_neng_password
=
A0S7f14f94e7
-
dcc
wan_neng_password
=
A0S7f14f94e7
-
dcc
...
@@ -18,6 +18,10 @@ wan_neng_password = A0S7f14f94e7-dcc
...
@@ -18,6 +18,10 @@ wan_neng_password = A0S7f14f94e7-dcc
phone
=
15300000000
phone
=
15300000000
password
=
Abc123
!
password
=
Abc123
!
[
test
]
[
email
]
student_new
=
reception
/
testsuites
/
apply_stuent_new
.
yml
host
=
smtp
.
exmail
.
qq
.
com
port
=
465
from_adress
=
huangqiang1
@
jiuaoedu
.
com
password
=
JhyC5M5rCtfBGsab
to_adresses
=
huangqiang1
@
jiuaoedu
.
com
,
mzx6010
@
dingtalk
.
com
Interface_Atuo_test/jiyunying/dingdingmessage.py
View file @
0db045b0
...
@@ -50,12 +50,13 @@ def send_dingding_message(web_hook,msg,message_type="text",is_at_all=False,at_mo
...
@@ -50,12 +50,13 @@ def send_dingding_message(web_hook,msg,message_type="text",is_at_all=False,at_mo
return
result
return
result
def
get_markdown_template
()
->
str
:
def
get_markdown_template
()
->
str
:
markdown_template
=
"""
"
markdown_template
=
"""
接口测试概要(${host})
\n
接口测试概要(${host})
\n
整体结果
: ${result}
\n
是否成功
: ${result}
\n
测试开始时间:${start_datetime}
测试开始时间:${start_datetime}
持续时间:${duration_time}
\n
持续时间:${duration_time}
\n
测试用例总数:${testcases_total},成功:${testcases_success},失败:${testcases_fail}
\n
测试用例总数:${testcases_total},成功:${testcases_success},失败:${testcases_fail}
(登录时为测试的账户数)
\n
测试调用接口总数:${teststep_total},成功:${teststep_success},失败:${teststep_failures},跳过:${teststep_skipped},错误:${teststep_errors}
测试调用接口总数:${teststep_total},成功:${teststep_success},失败:${teststep_failures},跳过:${teststep_skipped},错误:${teststep_errors}
"""
"""
return
markdown_template
return
markdown_template
...
...
Interface_Atuo_test/jiyunying/run.py
View file @
0db045b0
...
@@ -4,13 +4,13 @@ import sys
...
@@ -4,13 +4,13 @@ import sys
import
dingdingmessage
import
dingdingmessage
import
common
import
common
import
getdata
import
getdata
from
sendemail
import
SendEmail
def
run
():
def
run
():
report_path
=
common
.
readconf
(
"path"
,
"reportpath"
)
report_path
=
common
.
readconf
(
"path"
,
"reportpath"
)
logfile_name
=
common
.
get_time_name
()[
0
]
+
"_test.log"
logfile_name
=
common
.
get_time_name
()[
0
]
+
"_
interface_
test.log"
log_path
=
common
.
readconf
(
"path"
,
"logpath"
)
+
logfile_name
log_path
=
common
.
readconf
(
"path"
,
"logpath"
)
+
logfile_name
report_name
=
common
.
get_time_name
()[
1
]
+
"_test.html"
report_name
=
common
.
get_time_name
()[
1
]
+
"_
interface_
test.html"
runner
=
HttpRunner
(
report_dir
=
report_path
,
log_level
=
"INFO"
,
runner
=
HttpRunner
(
report_dir
=
report_path
,
log_level
=
"INFO"
,
log_file
=
log_path
,
report_file
=
report_name
,
failfast
=
True
)
log_file
=
log_path
,
report_file
=
report_name
,
failfast
=
True
)
...
@@ -21,8 +21,13 @@ def run():
...
@@ -21,8 +21,13 @@ def run():
# mapping=override_mapping
# mapping=override_mapping
for
test_case_path
in
path_or_testcases
:
for
test_case_path
in
path_or_testcases
:
runner
.
run
(
test_case_path
)
runner
.
run
(
test_case_path
)
# dingdingmessage.send_result_message(runner.summary)
dingdingmessage
.
send_result_message
(
runner
.
summary
)
send_email
=
SendEmail
()
subject
=
common
.
get_time_name
()[
0
]
+
"接口测试报告"
attachments
=
[]
attachment
=
"report/"
+
report_name
attachments
.
append
(
attachment
)
send_email
.
send_email
(
subject
,
"详情请下载查看附件"
,
attachments
=
attachments
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
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