pytest-allure报告生成

pytest生成allure报告步骤:

  1. 下载allure,配置allure报告的环境变量:把allure-2.13.7\bin 配置到环境变量path路径

验证:在dos窗口和pycharm窗口分别验证:allure --version

  1. 生成临时的json报告

在pytest.ini配置文件中添加生成临时json报告命令

addopts = -vs -m "mobile" --alluredir=./temp -clean alluredir

--alluredir=./temp #在temp目录下生成临时的json报告

-clean alluredir 清除temp文件夹中上次的报告,无该命令会进行累加生成

  1. 生成html格式的allure报告

在执行入口文件,即main函数下,添加系统命令:

if name == 'main':
pytest.main()
os.system('allure generate ./temp -o ./report --clean')

注: 出现Report successfully generated to .\report,说明allure报告生成成功,打开报告,如果测试报告页显示Not found,出现的原因可能是下载的allure包和python版本不匹配,重新下载最新的allure包进行解压,修改环境变量,重启pycharm即可

相关推荐
11路没有终点13 小时前
pytest Fixture 进阶:conftest 与依赖注入
pytest
2601_962387824 天前
web自动化测试实战教程【selenium/unittest/pytest】【共193课
selenium·pytest·devops·web自动化测试·unittest
weixin_440730504 天前
使用pytest中方法控制执行步骤(test_begin.py、test_end.py,@pytest.mark.run(order=1))
开发语言·python·pytest
2601_962297254 天前
Python、Pytest、Allure、Selenium和Jenkins实现自动化测试集成实例
python·selenium·jenkins·pytest·allure
2601_962077605 天前
从零搭建Python接口自动化测试框架:pytest+requests实战指南
python·pytest·接口自动化·requests·框架搭建
weixin_440730505 天前
pytest结合allure生成html测试报告(step、story、severity、screenshot)
前端·html·pytest·allure报告
拜托多多指教5 天前
【Pytest框架学习】分层架构
python·pytest
2601_962299885 天前
python脚本如何单元测试
python·单元测试·pytest·unittest·mock对象
Tizzy JJ6 天前
Python + pytest 接口自动化测试框架实战:从零搭建企业级项目骨架
开发语言·python·pytest
Tizzy JJ6 天前
接口自动化测试实战:如何围绕真实业务场景设计高质量用例
python·自动化·pytest