run.py编写:
import os
import time
current_path = os.path.dirname(os.path.realpath(__file__))
print(current_path)
report_path = os.path.join(current_path,‘report‘)
print(report_path)
case_path = os.path.join(current_path,‘test‘,‘case‘)
print(case_path)
report_name = time.strftime(‘%Y%m%d%H%M%S‘,time.localtime(time.time()))
print(report_name)
testsuite = unittest.TestLoader().discover(case_path)
filename = "{}\\{}.html".format(report_path,report_name)
f = open(filename, ‘wb‘)
runner = HTMLTestRunner.HTMLTestRunner(stream=f, title=‘redmine report‘,description=‘this is a report‘)
runner.run(testsuite)
f.close()
原文:https://www.cnblogs.com/jenny-jenny/p/14713497.html