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

四、效果展示

相关推荐
多米Domi0112 分钟前
0x3f 第21天 三更java进阶1-35 hot100普通数组
java·python·算法·leetcode·动态规划
小程故事多_8014 分钟前
从零吃透PyTorch,最易懂的入门全指南
人工智能·pytorch·python
Keep_Trying_Go1 小时前
基于无监督backbone无需训练的类别无关目标统计CountingDINO算法详解
人工智能·python·算法·多模态·目标统计
weixin_433179332 小时前
python - for循环,字符串,元组基础
开发语言·python
^哪来的&永远~2 小时前
Python 轻量级 UI:EEG 与 fNIRS 预处理图形界面
python·可视化·功能连接·eeg·mne·fnirs·eeglab
AI大佬的小弟2 小时前
Python基础(11):Python中函数参数的进阶模式详解
python·lambda函数·函数的参数解释·函数的参数进阶·位置参数·关键词参数·匿名函数与普通函数
智算菩萨2 小时前
Python可以做哪些小游戏——基于Python 3.13最新特性的游戏开发全指南(15万字超长文章,强烈建议收藏阅读)
python·pygame
智航GIS2 小时前
9.1 多线程入门
java·开发语言·python
nvd112 小时前
FastMCP 开发指南: 5分钟入门
人工智能·python
weixin_433179333 小时前
Python - word jumble游戏
开发语言·python