增加新的功能,通过beautiful 发送 效果

#!/user/bin/python3
#coding=utf-8
#2019/10/30 --16:21
#author :hui
import unittest,yagmail,time
from BeautifulReport import BeautifulReport as bf #导入BeautifulReport

'''导入要执行的类'''
from case_2 import Detail
from case_3 import List
from case_1 import Login
from case_4 import Wallet
from case_5 import Neayby
from case_6 import Price




if __name__ == '__main__':
# suite_tests = unittest.defaultTestLoader.discover(".",pattern="p_case*.py",top_level_dir=None)
# BeautifulReport(suite_tests).report(filename='oride测试报告', description='测试进行中', log_path=r'C:UsershuiPycharmProjects ew_oridelog est_log.txt',report_dir=r'C:UsershuiPycharmProjects ew_oride eport')


'''

说明:在使用addTest方法调用类名不能或方法名不能相同
否则报错:During handling of the above exception, another exception occurred:

'''

suit = unittest.TestSuite()

#如新增功能
suit.addTest(ConfigType("testoff"))#关闭城市车型配置
suit.addTest(OldVersion('test_old_version'))#乘客端旧版本
suit.addTest(OldVersion('test_old_version_no_ocar'))#旧版本不显示ocar
suit.addTest(ActList("test_act"))#乘客活动列表
suit.addTest(ActList("test_setting1"))#添加乘客快速位置
suit.addTest(ActList("test_setting2"))#取消乘客快速位置
suit.addTest(Detail("test_check"))#当前是最新版本
suit.addTest(Detail("test_coupon"))#优惠活动弹层




#通过实例化执行
run = bf(suit) # 实例化beautiful
run.report(description='测试进行中', filename='oride_report',report_dir=r'C:UsershuiPycharmProjects ew eport')


yag = yagmail.SMTP(user='269813@qq.com', password='xseaaj', host='smtp.qq.com', port='465')
body = "测试环境,oride-api"
yag.send(to=['47302@qq.com'], subject='api测试中', contents=[body,r'C:UsershuiPycharmProjects ew eport eport.html'])
print("已发送邮件")
原文地址:https://www.cnblogs.com/yanhuidj/p/12030802.html