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

四、效果展示

相关推荐
懂点Tech7 小时前
ctfshow misc28:GIF 高度修改解题与脚本实现
开发语言·windows·python
comedate7 小时前
SMLib 的 Examples 导读:PyAPI / SM_API / SMLib 三组示例怎么读
python·cad·smlib·examples·sm_api
云和数据.ChenGuang7 小时前
Python 重写(Override)深度解析:从 MRO 到 super() 的完整机制
java·开发语言·人工智能·python·langchain·1024程序员节
川石课堂软件测试8 小时前
学习软件测试需掌握的一些知识
数据库·python·sql·功能测试·网络协议·mysql·http
万化冥合8 小时前
PyBox屏幕键盘如何辅助演示键盘操作?
python·计算机外设
车软学堂9 小时前
从测试转开发,到底要补什么
网络·人工智能·python·功能测试·单片机·车载系统·自动化
天空依然蔚蓝9 小时前
分享一个自动检测网站在线状态的python程序
python·运维开发·1024程序员节
岁月宁静9 小时前
一个 AI 项目从本地到上线,要经过哪些步骤?全流程讲清楚
python·docker·agent
codists10 小时前
《crafting interpreters》阅读笔记:p45-p45
python
曲径海盗11 小时前
【Python 学习第 41 天】for 循环
python·学习笔记·编程入门