Dipa 2020-03-27
方法一:
# 创建测试运行程序 runner = unittest.TextTestRunner() runner.run(suite)
方法二:
# 使用BeautifulReport来执行测试套件中的用例,并生成报告 from BeautifulReport import BeautifulReport br = BeautifulReport(suite) br.report("第一份测试报告","brreport.html",report_dir=r"C:\project\py27_class\py27_01day")UI效果:
方法三:
# 使用 HTMLTestRunner来生成测试报告 # suite = unittest.defaultTestLoader.discover(r"") from HTMLTestRunnerNew import HTMLTestRunner runner = HTMLTestRunner(stream=open("new_report.html","wb"), title="第一份测试报告", tester="2c", description="第一个版本的测试" ) runner.run(suite)UI效果: