pytest系列—allure安装与环境变量配置(windows+Mac)

目录

一、下载allure文件

二、配置环境变量 

前言
        allure可以输出非常精美的测试报告,也可以和pytest进行完美结合,不仅可以渲染页面,还可以控制用例的执行。下面就对allure的使用进行一个详细的介绍和总结。

需要准备的环境:

  • python
  • pytest
  • allure-pytest
  • allure工具

allure用例描述
pytest系列—allure安装与环境变量配置(windows+Mac)_第1张图片

一、下载allure文件


   1、官网下载地址:https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/

pytest系列—allure安装与环境变量配置(windows+Mac)_第2张图片  windows下载.zip包就可以啦

 2.下载完直接解压就好了(记住路径呀)

pytest系列—allure安装与环境变量配置(windows+Mac)_第3张图片

二、配置环境变量 

windows版本

   1、复制路径如:D:\software\Python_install\allure-2.19.0\bin

    2、电脑底部搜索处输入:path

    3、环境变量  ----》新增环境编辑 ----》添加 D:\software\Python_install\allure-2.19.0\bin ---》保存

    4、cmd 中输入 where allure ,查看是否能找到

pytest系列—allure安装与环境变量配置(windows+Mac)_第4张图片

pytest系列—allure安装与环境变量配置(windows+Mac)_第5张图片  此时allure安装配置成功!!!!
pytest系列—allure安装与环境变量配置(windows+Mac)_第6张图片

 Mac版本

1、首先下载allure-commandline最新的zip文件包:

pytest系列—allure安装与环境变量配置(windows+Mac)_第7张图片

2、然后将zip包解压到目录中"/usr/local"

pytest系列—allure安装与环境变量配置(windows+Mac)_第8张图片

 pytest系列—allure安装与环境变量配置(windows+Mac)_第9张图片

3、进入到bin目录

pytest系列—allure安装与环境变量配置(windows+Mac)_第10张图片 

注意:

window下使用allure.bat 或 Linux下使用allure需要将allure添加到环境变量中。

4、命令行下输入: allure --version ,出现以下提示表示allure安装成功

pytest系列—allure安装与环境变量配置(windows+Mac)_第11张图片

按照上面的步骤安装好allure-commandline工具。

注意下载zip包的链接在官网中是http协议的,点击会报错,我们将协议改成http改成https访问链接就可以了。

allure添加到环境变量中
1、进入到当前用户目录下,执行:open .bash_profile,打开一个记事本。

2、编辑记事本,在文件最后输入:

PATH="/usr/local/allure-2.9.0/bin:$PATH"
export PATH

pytest系列—allure安装与环境变量配置(windows+Mac)_第12张图片
3、command+s 保存

4、然后命令行中输入:source .bash_profile,使配置立即生效;

5、任意目录下,命令行中输入allure,出现以下提示表示环境变量配置成功;

注意:执行allure命令时,需要jdk的支持,因此使用allure的前提是系统中安装了jdk并且配置了环境变量

你可能感兴趣的:(pytest,macos)