使用HTMLTestRunner模块生成测试报告

步骤:

1、下载HTMLTestRunner模块

HTMLTestRunnerCN.py是中文版本的,EN是英文版本的,将要使用的版本放到Python安装目录下lib文件夹中,然后试试看能不能import,能import就表示OK了

2、导入模块

3、使用模块 创建测试执行器时使用该模块

fp = open('./ddd.html','wb')
print('aaaa')
#创建测试执行器testrunner
runner = HTMLTestReportCN.HTMLTestRunner(
stream=fp,
title='xx项目测试报告',
description='详细测试用例结果',
tester='xuyujuan')
runner.run(suite)
fp.close()

参数说明:
stream:是测试报告存放的地方和报告的名字
title:是报告中显示最上方的标题
description: 是展示在报告中的文字描述
tester: 是报告中的测试人员

4、执行文件
 
原文地址:https://www.cnblogs.com/aiyumo/p/11766296.html