pytest一些要安装的和打印报告
1.安装
pip install pytest
2.插件
测试顺序随机
pip install pytest-randomly
分布式测试
pip install pytest-xdist
出错立即返回
pip install pytest-instafail
3.测试报告
计算pytest执行覆盖率
pip install pytest-cov
生成html测试报告
pip install pytest-html
生成allure测试报告
pip install allure-pytest(下载allure)
allure下载地址:https://github.com/allure-framework/allure2/releases
allure环境变量:D:\allure\bin
案例:1生成html文件
pytest 02.py --html=report.html
未指定路径则在代码原路径生成report.html报告

2.生成allure测试报告
(1)执行测试类pytest *.py --alluredir 生成报告路径(不要改生成的报告文件的名字,我改了一直找不到-_-)
pytest 02.py --alluredir ./report/allure_raw

(2)查看报告allure serve 报告路径,自动打开浏览器
allure serve report/allure_raw


浙公网安备 33010602011771号