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()