增加新的功能,通過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:\Users\hui\PycharmProjects\new_oride\log\test_log.txt',report_dir=r'C:\Users\hui\PycharmProjects\new_oride\report')


'''

說明:在使用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:\Users\hui\PycharmProjects\new\report')


yag = yagmail.SMTP(user='[email protected]', password='xseaaj', host='smtp.qq.com', port='465')
body = "測試環境,oride-api"
yag.send(to=['[email protected]'], subject='api測試中', contents=[body,r'C:\Users\hui\PycharmProjects\new\report\report.html'])
print("已發送郵件")
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章