首页 > 其他分享 >httprunner 生成allure报告

httprunner 生成allure报告

时间:2023-02-07 15:57:06浏览次数:41  
标签:httprunner 报告 pytest 生成 allure 安装

一、环境准备

python 3.7.7
httprunner 3.1.4安装的时候,会自动安装 pytest 和 pytest-html 插件,对应的版本号是
pytest 5.4.3
pytest-html 2.1.1
HTTPrunner 默认并未安装 allure,需要另外安装。安装有两种方式:
安装allure的 pytest 依赖库allure-pytest  pip install allure-pytest
安装 HTTPrunnerallure 依赖库 httprunner[allure]  pip install "httprunner[allure]"

二、安装allure,下载并配置环境

需要去github上下载https://github.com/allure-framework/allure2/releases
下载完成之后,解压到本地电脑,把bin目录添加到环境变量Path下


 查看版本成功

 三、运行用例,生成报告

step1:生成Allure报告数据

hrun testcases --alluredir=allure-results --clean-alluredir
#--alluredir=DIR: 生成 allure 报告的原始数据到指定目录
#-clean-alluredir: 如果指定目录已存在则清理该文件夹
#--allure-no-capture:不要将 pytest 捕获的日志记录(logging)、标准输出(stdout)、标准错误(stderr)附加到报告中

step2:生成Allure报告

allure generate allure-results -o allure-report -c
#-o 指定生成报告的文件夹
#-c 在生成报告之前先清理之前的报告目录

step3:查看Allure报告

allure open allure-report

 

标签:httprunner,报告,pytest,生成,allure,安装
From: https://www.cnblogs.com/listening-y/p/17098746.html

相关文章