pytest结合allure-pytest插件生成测试报告

目录

一、安装allure-pytest插件

二、下载allure

三、生成allure报告

四、效果展示


一、安装allure-pytest插件

二、下载allure

下载之后解压,解压之后还要配置环境变量(把allure目录下bin目录配置到系统变量的path路径),下载地址:https://github.com/allure-framework/allure2/releases

验证allure是否安装成功:allure --version

1)先在dos窗口验证

2)在pycharm中验证(如果这里失败了,那么需要重启pycharm)

三、生成allure报告

1)生成临时的json报告,在pytest.ini文件里面加入一下内容:

addopts = -vs --alluredir=./temps --clean-alluredir

--alluredir=./temps 生成临时报告

--clean-alluredir 清空临时报告

2)生成正式的allure报告

python 复制代码
if __name__ == '__main__':
    pytest.main()
    time.sleep(3)
    os.system("allure generate ./temps -o ./reports --clean")

四、效果展示

相关推荐
Scott9999HH1 小时前
【IIoT流量实战】蒸汽管道阀门全关却仍有流量?用 Python 实现涡街信号 FFT 频谱分析与温压全补偿积算网关,深度拆解靠谱的涡街流量计厂家硬核技术标准
开发语言·python
AI云海2 小时前
python 列表、元组、集合和字典
开发语言·python
二十雨辰3 小时前
[爬虫]-Urllib
爬虫·python
玉鸯5 小时前
Agent Hook:在概率推理之上,为 Agent 叠加确定性控制
python·langchain·agent
weixin_446260855 小时前
HACO:面向动态部署环境的对冲式智能计算可靠多智能体调度框架
后端·python·flask
我的xiaodoujiao5 小时前
API 接口自动化测试详细图文教程学习系列32--Allure测试报告2
python·学习·测试工具·pytest
qetfw6 小时前
MXU:Tauri 2 + React 的 MaaFramework 跨平台 GUI 源码
前端·python·react.js·前端框架·开源项目·效率工具
用户8356290780517 小时前
Python 实现 Excel 页面布局与打印设置自动化
后端·python
一次旅行7 小时前
Python+大模型端到端自动化日报系统
开发语言·python·自动化