标签:需要 script stderr stream inf err tca ptime rip
1.引入HTMLTestRunner
2.修改 HTMLTestRunner.py
3.测试报告的生成
import unittest from HTMLTestRunner import HTMLTestRunner from UnittestDemo.test_mathfunc import TestMathFunc if __name__ == "__main__": suite = unittest.TestSuite() # 执行加法、减法、除法 tests=[TestMathFunc("test_add"),TestMathFunc("test_divide"),TestMathFunc("test_minus")] suite.addTests(tests) # addTest,添加单个 TestCase # suite.addTest(TestMathFunc("test_multi")) f = open("d:\\reporter.html","wb") runner = HTMLTestRunner(stream=f, title="测试报告",description="测试用例执行情况") runner.run(suite)
标签:需要 script stderr stream inf err tca ptime rip
原文地址:https://www.cnblogs.com/yangyang521/p/10076761.html