自己的代码
import unittest
# import HTMLTestRunner_cn as HTMLTestRunner
import xmlrunner
import sys
sys.path.append("..")
from testcase.test_01_login import TestLogin login_tests = unittest.TestLoader().loadTestsFromTestCase(TestLogin) suite=unittest.TestSuite()
all_case=unittest.defaultTestLoader.discover('testcase','test_01*.py')
# for case in all_case:
# suite.addTest(case)
[suite.addTest(case) for case in all_case]#列表生成式,和上面代码是一样的
runner=xmlrunner.XMLTestRunner('.')#这是是为了产生报告给Jenkins看 runner=xmlrunner.XMLTestRunner(output='report')#指定生成目录
runner.run(suite)#运行用例