失败重跑需要依赖pytest-rerunfailures插件,使用pip安装就行
pip install pytest-rerunfailures   


安装pytest
pip install -U pytest


安装pytest-html的测试报告
pip install pytest-html


pytest-allure报告安装
pip install pytest-allure-adaptor

启动-带测试报告
pytest test_log.py --html=report.html


启动-带测试报告(保存css样式)
pytest test_log.py --html=report.html --self-contained-html


失败重跑  加reruns参数
pytest test_log.py --reruns 2 --html=report.html --self-contained-html


启动-带测试报告(保存到指定路径)
pytest test_log.py --reruns 2 --html=d:/test/report.html --self-contained-html


生成xml报告(allure)
pytest -s -q --alluredir report


如果不指定路径,默认在当前目录下新建一个report目录,也可以指定路径
pytest -s -q --alluredir 指定report路径


pytest test_log.py --html=d:/test/report.html --self-contained-html

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐