• httprunner版本:2.5.4,jinja2版本:2.11
  • httprunner输出的html测试报告:默认的模板文件的路劲为 (python安装路径)+Lib+site-packages+httprunner/templates/report/html/template.html(使用的是jinja2的格式),可在gen_report.py中的gen_html_report方法中找到

  • HttpRunner--自定义输出报告

  • 修改模板中以下标红字体

  • HttpRunner--自定义输出报告

  •  

  • 因为在jinja2中 {% if %} 和 {% endif %}是成对出现的,所以需要在末尾处添加 endif ,如下图

  • HttpRunner--自定义输出报告

执行测试用例时,添加--report-template  路径/template_fail_only.html,如下:其中路径更换为自己默认所在的路径哦,以下是我本地的路径

HttpRunner--自定义输出报告

执行成功后,报告中只显示失败的用例详情。

HttpRunner--自定义输出报告

相关文章:

  • 2021-09-26
  • 2022-01-19
  • 2021-07-05
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2021-05-22
  • 2021-07-21
猜你喜欢
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2022-02-01
  • 2021-09-25
相关资源
相似解决方案