UnitTest + HTMLTestRunner
#导入HTMLTestRunner类 from unitTest.tools1.HTMLTestRunner import HTMLTestRunner import unittest discover = unittest.defaultTestLoader.discover("./cases",pattern='test*.py') #报告生成路径 with open("./report/ha.html","wb") as f: h=HTMLTestRunner(stream=f,title="测试报告",description="windows chrome") h.run(discover)