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

相关推荐
欲游山河十万里6 小时前
pytest(三)——参数化@pytest.mark.parametrize
pytest
奶茶精Gaaa4 天前
pytest
pytest
霍格沃兹测试开发学社测试人社区6 天前
软件测试学习笔记丨Pytest 学习指南
软件测试·笔记·测试开发·学习·pytest
神即道 道法自然 如来8 天前
测试面试题:pytest断言时,数据是符点类型,如何断言?
pytest
high_tea8 天前
pytest - 多线程提速
python·pytest
傻啦嘿哟10 天前
自动化测试框架集成:将Selenium集成到pytest与unittest中
selenium·测试工具·pytest
一名在八月份找工作的测试员10 天前
自动化学习1:pytest自动化框架的基本用法:注意事项/断言assert/测试结果分析
学习·自动化·pytest
什么时候才能变强11 天前
Pytest-如何将allure报告发布至公司内网
linux·服务器·pytest
一名在八月份找工作的测试员12 天前
自动化学习2:pytest的高级用法(mark标记/fixture/hook)
学习·自动化·pytest