6、unittest示例

testcase.py
from rip_dictionary.rip_datacreate.business.createUrl import AAA import unittest import HTMLTestRunner class TestCreat(unittest.TestCase): @classmethod def setUpClass(cls): cls.abc = AAA() def testUrl_01(self): ‘‘‘ xx接口正向调用 ‘‘‘ self.assertEqual(self.abc.creaturl(),True) print(‘接口调用成功!) def testUrlMysql_02(self): ‘‘‘ 数据库验证 ‘‘‘ self.assertEqual(self.abc.rip_sql(),True) print(mysql验证成功!) if __name__ == __main__: report_path = E:/rip_auto/rip_dictionary/rip_datacreate/report/testReport.html fp = open(report_path,wb) suite = unittest.TestSuite() suite.addTest(TestCreat(testUrl_01)) suite.addTest(TestCreat(testUrlMysql_02)) runner = HTMLTestRunner.HTMLTestRunner(stream=fp, title=u这个我的测试报告, description=u测试用例情况) runner.run(suite) # fp.close()

 

6、unittest示例

上一篇:noip模拟46 *skw的树


下一篇:GateWay与熔断器