all_run.py
1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# @Time : 2022/8/23 15:13
# @Author : 付孟奇
from unittestreport import TestRunner
from util.HandleJenkins import handle_jenkins
from util.HandleData import handle_data
from config.VendorPath import base_path
import unittest
# 执行的项目文件目录
pro = handle_jenkins()['pro']
email_data = handle_jenkins()['email']
email = str(email_data).split(',')
if len(email) > 1:
email = ','.join(email)
title = handle_jenkins()['title']
env = handle_jenkins()['env']
# 执行数据库初始化
# TODO
# handle_data.db_ini()
# handle_data.handle_global()
# 执行文件地址
# TODO
suite_case = unittest.defaultTestLoader.discover(base_path + '/case/', pattern='*.py')
runner = TestRunner(suite_case,
filename="report.html",
report_dir='./report',
title=title,
tester='测试组',
desc='接口自动化测试报告',
templates=1,
pro=pro,
env=env
)
runner.run()
# runner.send_email(host="smtp.exmail.qq.com",
# port=465,
# user="fumengqi@situdata.com",
# password="Fz315824",
# to_addrs=email)
# 执行数据库清理
# TODO