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

四、效果展示

相关推荐
Gu Gu Study1 小时前
ScoutLoop开放域深度研究引擎(agent的初步设计想法)
人工智能·python
卷无止境2 小时前
写代码这件事,到底该讲究点什么?
后端·python
卷无止境2 小时前
循环复杂度到底在算什么,Python 代码怎么才能写得让人一看就懂
后端·python
lpfasd1232 小时前
MediaCrawler 项目深度分析
chrome·python·chrome devtools
Dxy12393102163 小时前
Python项目打包成EXE完整教程(PyInstaller实战避坑)
开发语言·python
bamb003 小时前
一个项目带你入门AI应用开发01
python
0566463 小时前
Python康复训练——常用标准库
开发语言·python·学习
昆曲之源_娄江河畔3 小时前
Python如何安装flask, pymssql
开发语言·python·flask·pymssql
0566464 小时前
Python康复训练——控制流与函数
开发语言·python·学习
天使day4 小时前
FastAPI快速入门
python·fastapi