首页 技术 正文
技术 2022年11月21日
0 收藏 464 点赞 2,137 浏览 1136 个字

前言

allure是一个report框架,支持java的Junit/testng等框架,当然也可以支持python的pytest框架,也可以集成到Jenkins上展示高大上的报告界面。

环境准备

  • 1.python3.6
  • 2.windows环境
  • 3.pycharm
  • 4.pytest-allure-adaptor
  • 5.allure2.7.0
  • 6.java1.8

安装 Command Tool

allure的版本目前有2个,从github上看,allure1不再被支持,请考虑使用allure2 https://github.com/allure-framework/allure2替代

allure2生成html报告

allure-commandline releases版本https://github.com/allure-framework/allure2/releases

下载最新的Download allure2.7.0版本

allure2生成html报告

[下载Download allure2.7.0 地址:https://dl.bintray.com/qameta/generic/io/qameta/allure/allure/2.7.0/allure-2.7.0.zip]
(https://dl.bintray.com/qameta/generic/io/qameta/allure/allure/2.7.0/allure-2.7.0.zip)

下载好之后,解压到运行pytest的目录下

allure2生成html报告

打开\allure-2.7.0\bin文件夹,会看到allure.bat文件,讲此路径设置为系统环境变量path下,这样cmd任意目录都能执行了

allure2生成html报告

比如我的路径:D:\YOYO\case\allure-2.7.0\bin

allure2生成html报告

一、安装allure-pytest

1、安装命令:pip install allure-pytest

二、安装pytest-html

安装命令:pip install pytest-html

三、运行allure2

运行用例的命令

 pytest D:\workspaces\python\allurePython\test_feature.py --alluredir=./allure-results/

四、生成报告的命令

allure generate report/ -o allure-reports/

执行完之后目录结构如下:

allure2生成html报告

打开报告

直接找到report/html打开index.html会显示一个空的报告,这里用pycharm去打开

allure2生成html报告

打开后报告展示

allure2生成html报告

依赖java环境

之前用的jdk1.7版本,执行allure时候报错:Unsupported major.minor VERSION 51.0
由于allure2是java开发的,需要依赖java环境,解决办法:jdk版本用1.8就可以了

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,905
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,430
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,247
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,058
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,690
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,727