标签:单元测试 框架 ffffff span str code 除法 main col
1.test_suit执行测试用例及输出结果前 添加如下代码(打开会新建d:/result.txt文件):
with open("d:\\result.txt","a") as f:
import unittest 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) with open("d:\\result.txt","a") as f: #verbosity = 2 查看完成的执行情况 runner = unittest.TextTestRunner(stream=f, verbosity=2) runner.run(suite)
标签:单元测试 框架 ffffff span str code 除法 main col
原文地址:https://www.cnblogs.com/yangyang521/p/10073255.html