Pytest-allure安装及环境配置

前提

  安装jdk1.8及以上版本才可行运行allure。

 

一 allure 和 pytest 相关环境安装

1 # allure
2 pip3 install allure-pytest -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
3 
4 #pytest
5 pip3 install pytest -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
# Mac
# 安装brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# 安装allure
brew install allure

# 验证安装结果,打开终端
allure --version

 

二 配置 allure 环境变

  官网下载地址:https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/,一般选择v2.13.5

  1 win

  解压,复制地址包含\bin,将该地址添加到环境变量下;

  打开cmd输入allure --version,有版本信息输出几代表配置成功。

 

  2 Mac

  解压,选中allure-2.7.0,右键->显示简介:查看位置信息(如果直接在下载文件夹没有,默认为:/Users/xx/Downloads/allure-2.7.0/bin/。只需更改用户名xx便可复用)

  配置环境变量:1、打开配置文件:终端输入   open -t ~/.bash_profile

   PATH="/Users/liujing/Downloads/allure-2.7.0/bin:${PATH}"

  export PATH

  使配置的环境变量生效:source ~/.bash_profile。

  终端输入allure --version ,显示版本号,安装成功

 

三 allure测试报告是基于pytest运行后,生产的json文件来展示结果,以web工程的形态展示最终的测试结果

  要集成pytest实现allure的展示,需要安装:

pip install allure-pytest

验证:pip show allure-pytest

posted @ 2021-04-18 11:39  术科术  阅读(623)  评论(0编辑  收藏  举报