生成测试报告
测试报告 一
通过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中的配置信息