废话不多说,直接上代码
代码
__author__ = ‘huyang:十一的杂文录‘ import unittest import HtmlTestRunner import sys sys.path.append(r‘C:\Users\Administrator\Desktop\新建文件夹‘) class ACase(unittest.TestCase): def test1(self): c = 3+4 self.assertEqual(c, 7, msg=‘xx‘) def test2(self): a = True self.assertFalse(a, msg=‘错误‘) if __name__ == ‘__main__‘: suite = unittest.TestSuite() suite.addTest(ACase(‘test1‘)) suite.addTest(ACase(‘test2‘)) HtmlTestRunner.HTMLTestRunner(report_title=‘huyang_test_doc‘, output=‘res‘).run(suite)
测试报告