function.py
2.1 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
47
48
# -*- coding: utf-8 -*-
# ======================================
# @Software: PyCharm
# @Author : Shitou ✊
# @Time : 2023/1/12 18:26
# @FileName: function.py
# ======================================
"""
"""
from unittestreport import TestRunner
from common.handle_config import conf
from common.handle_path import TestCase_Path, Report_Path
# 运行文件
def runner_test(suite):
runner = TestRunner(suite=suite,
filename=conf.get("report", "filename"),
report_dir=Report_Path,
title=conf.get("report", "title"),
tester=conf.get("report", "tester"),
desc=conf.get("report", "desc"),
templates=conf.getint("report", "templates")
)
# runner.run()
# 执行失败重新运行机制
runner.rerun_run(count=3, interval=0.2)
"""
发送钉钉
"""
# # Webhook = "https://oapi.dingtalk.com/robot/send?access_token=cb3e40995683f06c5be06074e0cf617f2ea208156e3b4bf6247b56a212b8b7c3"
# Webhook = "https://oapi.dingtalk.com/robot/send?access_token=054f620071c74d94c10ad556743aa5ff0600a2953bbce5529ca057f75ad2423e" # 优秀学乐业钉钉群
# runner.dingtalk_notice(url=Webhook,
# key="石头测试", # 传入钉钉设置的对应关键字
# atMobiles=["17301249973"], # 发送通知钉钉中要@人的手机号列表
# isatall=False, # 是否@所有人,默认为False,设为True则会@所有人
# except_info=True # 是否发送未通过用例的详细信息,默认为False
# )
"""
发送邮件
"""
# runner.send_email(host="smtp.qq.com",
# port=465,
# user="shishut@foxmail.com",
# password="uwgmbvzjfscqbeeh",
# to_addrs=["shishut@workai.com.cn"]
# # to_addrs=["shishut@workai.com.cn", "wangf@workai.com.cn"]
# )