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即可

相关推荐
不拘一格的叶三少4 天前
Pytest + Playwright 自动化测试工程设计要点 & 目录结构
测试工具·pytest
努力搬砖的咸鱼5 天前
意图理解:让Agent从需求描述自动生成Pytest测试策略
人工智能·python·ai·单元测试·pytest·agent
St_rive8 天前
Pytest skip&&skipif跳过⽤例
运维·服务器·pytest
努力搬砖的咸鱼10 天前
AI Agent测试全景图:它到底改变了什么
人工智能·python·ai·集成测试·pytest·agent·ai编程
X1A0RAN12 天前
自动化流水线提效·微观篇:pytest 执行顺序优化
自动化·pytest
久久学姐19 天前
Python+Playwright+Pytest+BDD,用FSM打造高效测试框架
python·pytest·bdd·playwright·fsm
小白上线*^_^*20 天前
Pytest 自动化测试框架速通指南(二)
软件测试·pytest·python测试框架·ai测试基础
Logintern0921 天前
pytest的AST 断言重写
pytest
Tinyfacture21 天前
接口自动化之添加商品(pytest)
python·测试工具·自动化·pytest