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")

四、效果展示

相关推荐
花酒锄作田4 小时前
企业微信机器人与 DeepAgents 集成实践
python·mcp·deepagents
likerhood6 小时前
java中`==`和`.equals()`区别
java·开发语言·python
qq_283720057 小时前
Python Celery + FastAPI + Vue 全栈异步任务实战
vue.js·python·fastapi
2401_885885047 小时前
营销推广短信接口集成:结合营销策略实现的API接口动态变量填充方案
前端·python
telllong8 小时前
Python异步编程从入门到不懵:asyncio实战踩坑7连发
开发语言·python
lulu121654407810 小时前
Claude Code Harness架构技术深度解析:生产级AI Agent工程化实践
java·人工智能·python·ai编程
7年前端辞职转AI12 小时前
Python 文件操作
python·编程语言
龙文浩_12 小时前
AI梯度下降与PyTorch张量操作技术指南
人工智能·pytorch·python·深度学习·神经网络·机器学习·自然语言处理
呱牛do it12 小时前
企业级绩效考核系统设计与实现:基于FastAPI + Vue3的全栈解决方案
python·fastapi
7年前端辞职转AI12 小时前
Python 容器数据类型
python·编程语言