pytest接口测试(七)生成HTML测试报告

生成测试报告

测试报告 一

通过pip命令进行安装,安装完成后,执行:pytest --html=.report/report.html --self-contained-html

pip install pytest-html 

–html=.report/report.html 指定测试报告路径和名称
–self-contained-html 在html页面本地加载css样式
在这里插入图片描述
会生成一个简单的html测试报告

测试报告 二

pip install PyTestReport

在命令行执行pip install命令进行安装,完成后输入pytest --pytest_report Pytest_Report.html
测试报告截图
在这里插入图片描述
可以在pytest.ini配置文件下配置,在cmd命令行运行时,只需要输入pytest,不输入后面那一长串,在执行的时候会自动加上:

addopts = --pytest_report Pytest_Report.html

在执行的时候会自动读取pytest.ini中的配置信息

发布了28 篇原创文章 · 获赞 0 · 访问量 384

猜你喜欢

转载自blog.csdn.net/qq_42098424/article/details/103993685