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

相关推荐
霍格沃兹测试学院-小舟畅学3 天前
AI+Swagger:一键生成500条pytest接口用例
人工智能·pytest
把头塞进显示器12 天前
电商平台-测试报告
python·selenium·pytest
昔我往昔17 天前
pytest日志问题排查记录
python·pytest
黄昏恋慕黎明20 天前
博客论坛技术迭代
python·pytest
2601_9620782320 天前
Python接口自动化流程(pytest)
python·pytest·接口自动化·测试框架·断言
杨女士YRJ20 天前
python+pytest+01
python·pytest
2601_9620782321 天前
Python接口自动化框架:pytest
python·pytest·接口自动化·测试框架·restfulapi
2601_9620781921 天前
Appium+Python+pytest自动化测试框架详解
自动化测试·python·appium·pytest·移动应用
2601_9622845023 天前
安卓APP UI自动化测试:Python + UiAutomator2 + pytest + pytest-html
python·pytest·uiautomator2·ui自动化测试·安卓app
2601_9623008123 天前
基于pytest的接口自动化测试:使用requests模块的实战项目与接口关联方法详解
接口自动化测试·测试用例·pytest·接口关联·requests模块