【Allure】Allure安装及生成报告

Allure

1、安装地址

https://github.com/allure-framework/allure2/releases
下载后解压到pytest文件夹下:C:\Users\dxj\AppData\Local\Programs\Python\Python37\Lib\site-packages\pytest

2、配置环境变量

系统变量path配置:C:\Users\dxj\AppData\Local\Programs\Python\Python37\Lib\site-packages\pytest\allure-2.17.3\bin
配置好,cmd ——》allure 出现Usage: allure [options] [command] [command options] 代表配置好
此处爬过一个坑,cmd中运行allure,pycharm的运行台提示“allure不是内部命令”
#解决方法:重启下pycharm

3、使用报告

#执行pytest单元测试,生成 Allure 报告需要的数据存在 /temp 目录
pytest.main([‘–alluredir’, ‘./temp’])
#执行命令 allure generate ./temp -o ./report --clean ,生成测试报告
os.system(‘allure generate D:\workspace\python_pytest/temp -o D:\workspace\python_pytest/report --clean’)

这个地方注意下:生成报告的路径,用./这种方式容易报错~~~~,最好给出绝对路径,避免程序找不到文件
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值