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

四、效果展示

相关推荐
键盘上的猫头鹰22 分钟前
【Linux 基础教程(四)】文件内容查看、打包压缩与搜索、重定向管道及环境变量
linux·服务器·python
独挽离人25 分钟前
【无标题】
python
天天进步20151 小时前
Python全栈项目--社区问答平台
开发语言·python·django
噜噜噜阿鲁~1 小时前
python学习笔记 | 12.0、错误、调试和测试
笔记·python·学习
AI视觉网奇2 小时前
Bambu Studio 发现 xx个开放边
开发语言·人工智能·python
SilentSamsara2 小时前
缓存策略实战:Redis + Python 多级缓存设计与失效策略
开发语言·redis·python·缓存·性能优化
本地化文档2 小时前
psycopg3-docs-l10n
数据库·python·postgresql·github·gitcode·sphinx
JeJe同学2 小时前
LabelImg 标签字体大小修改教程
linux·人工智能·python
Irissgwe2 小时前
【无标题】
python·langchain·ai编程·langgraph
RSTJ_16252 小时前
PYTHON+AI LLM DAY SIXTY-SIX
服务器·开发语言·python