python-生成HTMLTestRunner测试报告

1.先下载HTMLTestRunner.py
2.修改里面的内容,参考https://www.cnblogs.com/camilla/p/7243044.html
3.把HTMLTestRunner.py拷贝到所属环境的\Lib下,如图所示
python-生成HTMLTestRunner测试报告_第1张图片
4.import HTMLTestRunner,如图所示

import unittest
from testcases.test_creat_norm_cases import Test_Create_Norm_cases
import HTMLTestRunner
import time
if name == ‘main’:
testunit = unittest.TestSuite()
testunit.addTest(Test_Create_Norm_cases(‘test_creat_norm’))
filename = u’D:\linuxshell\ArticleScrider\selenium_pom_pye\report\%s.html’ % time.strftime(’%Y%m%d%H%M%S’, time.localtime())
with open(filename,‘wb’) as fp:
runner = HTMLTestRunner.HTMLTestRunner(stream=fp,title=u’指标信息配置创建报告’,description=u’测试用例结果’,verbosity=2)
runner.run(testunit)

你可能感兴趣的:(selenium)