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

相关推荐
我的xiaodoujiao1 天前
API 接口自动化测试详细图文教程学习系列9--Requests模块
python·学习·测试工具·pytest
我的xiaodoujiao1 天前
API 接口自动化测试详细图文教程学习系列10--Requests模块2--举例说明
python·学习·测试工具·pytest
超梦梦梦梦3 天前
playwright&pytest
pytest
不明觉厉二十年6 天前
pytest+pywinauto+pycharm制作mobaxterm 字符串快捷发送器 Demo
ide·pycharm·pytest
春日见8 天前
TEST文件夹:Pytest,集成测试,单元测试
服务器·人工智能·驱动开发·单元测试·计算机外设·集成测试·pytest
TRACER~858 天前
项目实战:pandas+pytest+allure+adb
adb·pandas·pytest
Franciz小测测9 天前
Pytest 并发分组执行引擎(支持UI / 接口自动化测试):从设计到工程落地
pytest
小猪咪piggy9 天前
【接口自动化】(2) pytest 测试框架
运维·自动化·pytest
忘忧记9 天前
Pytest + Requests + YAML 数据驱动+日志模块
网络·python·pytest
清水白石00810 天前
pytest Fixture 设计实战指南:作用域、依赖链、自动清理与测试资源高效复用
python·pytest