pytest 执行用例生成报告
1. pytest-html
pytest -vs --reruns 1 --html=report.html --self-contained-html
pytest -vs --reruns 1 --html=TestReport_"%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%-%time:~3,2%-%time:~6,2%".html --self-contained-html # 报告名称加入当前时间
-q 与-v/--verbose相反,显示整体结果,按模块展示结果,;
-v/--verbose 输出信息更详细,每个用例占一行;
-s 输出print&log,等价于 --capture=no
-vs 用例结果+print&log
2.allure
cmd命令能启动allure serve
d:
cd D:\workspace\Goodslspytest1217\TestSuits\TestGoods
pytest --alluredir ./report/allure
allure serve \report\allure
cmd 命令启动不了allure serve
d:
cd D:\workspace\Goodslspytest1217\TestSuits\TestGoods
pytest --alluredir ./report/allure
cd d:\allure-2.13.0\bin
allure
allure serve D:\workspace\Goodslspytest1217\TestSuits\TestGoods\report\allure