【pytest-9】pytest-html生成报告

前言

pytest-html是一个插件,pytest用于生成测试结果的html报告,兼容python2.7和3.6

pytest-html

1.github上源码地址【https://github.com/pytest-dev/pytest-html】

2.pip安装

 pip install pytest-html

我这里是安装了的,所以不做演示。

 3.执行

$ pytest --html=report.html

 4.执行完之后,在当前目录会生成一个report.html的报告文件,显示效果如下

 指定生成报告路径和名称

1.直接执行"pytest --html=report.html"生成的报告会在当前脚本的同一路径,如果想指定报告的存放位置,放到当前脚本的同一目录下的report文件夹里

pytest --html=./report/report.html

效果:

 2.如果想指定执行某个.py文件用例或者某个文件夹里面的所有用例,需加个参数。

pytest test_d.py --html=./report/report.html

 

posted @ 2020-12-01 15:33  做一只热爱生活的小透明  阅读(107)  评论(0)    收藏  举报