import unittest
from class_unittest.test_login import TestLogin
from HTMLTestRunnerNew import HTMLTestRunner
from BeautifulReport import BeautifulReport
# s = unittest.TestSuite()
# s.addTest(TestLogin("test_login_ok")) #添加1个用例
# s.addTests([TestLogin("test_login_ok"),TestLogin("test_login_ok"),TestLogin("test_login_ok"),TestLogin("test_login_ok")]) #添加多个用例
s = unittest.TestLoader().discover(r"E:BaiduNetdiskWorkspacepython-study")#项目路径(testcase的路径)
#运行测试用例 并生成测试结果
# runner = unittest.TextTestRunner()
# runner.run(s)
#基于HTMLTestRunner 生成html测试报告
with open(r"report.html",'wb') as f:
runner = HTMLTestRunner(f,title = "自动化测试",tester = 'lee')
runner.run(s)
#基于BeautifulReport生成Html测试报告
br = BeautifulReport(s)
br.report("第一份Html测试报告","bfreport.html")