-
Allure报告
2020-02-04 17:05:41Allure报告 Allure介绍 Allure是一个独立的报告插件,生成美观易读的报告,目前支持语言:Java, PHP, Ruby, Python, Scala, C#。 Allure安装 1.安装pytest的插件包pytest-allure-adaptor: pip install allure-...Allure报告
Allure介绍
Allure是一个独立的报告插件,生成美观易读的报告,目前支持语言:Java, PHP, Ruby, Python, Scala, C#。
Allure安装
1.安装pytest的插件包pytest-allure-adaptor: pip install allure-pytest
Allure帮助文档
https://docs.qameta.io/allure/#_about
生成Allure报告
命令行参数:pytest --alluredir report # 在执行命令目录生成report文件夹,文件夹下包含xml文件
- 示例
pytest.ini [pytest] addopts = -s --alluredir report # 测试路径 testpaths = ./Test # 测试文件名 python_files = test_*.py # 测试类名 python_classes = Test_* # 测试的方法名 python_functions = test_*
test_all.py class Test_allure: def setup(self): pass def teardown(self): pass def test_al(self): assert 0
操作步骤: 1.命令行进入pytest.ini所在目录 2.输入命令:pytest 执行结果: 1.pytest.ini所在目录生成report文件夹,文件夹下生成一个json文件
-
python allure报告_pytest+allure+jenkins,生成allure报告
2021-02-09 01:04:201、本地生成allure报告1、安装依赖allure-2.13.2allure-pytest-2.8.11pytest-5.4.1python-jenkinsjdk-1.82、安装后验证安装是否成功pip list3、配置环境变量jdk-1.8pytest-5.4.1allure-2.13.24、编写示例代码...1、本地生成allure报告
1、安装依赖
allure-2.13.2
allure-pytest-2.8.11
pytest-5.4.1
python-jenkins
jdk-1.8
2、安装后验证安装是否成功
pip list
3、配置环境变量
jdk-1.8
pytest-5.4.1
allure-2.13.2
4、编写示例代码Demo
import allure
import pytest
class Test_Pytest():
@allure.feature("测试成功的用例")
def test_one(self):
print("test_one方法执行")
assert 1 == 1
@allure.feature("测试失败的用例")
def test_two(self):
print("test_two方法执行")
assert "s" in "love"
@allure.feature("测试失败的用例")
def test_three(self):
print("test_three方法执行")
assert 3 - 2 != 1
@allure.feature("测试失败的用例")
def test_four(self):
print("test_four方法执行")
if __name__ == "__main__":
pytest.main(["-s", "-q", "--alluredir", "./report"])
通过命令执行test_Pytest.py,生成allure报告
# 指定report存放位置,结果存放到文件中
# report中生成的是json文件
pytest test_Pytest.py --alluredir report
# 此命令将report下面的json文件渲染成HTML结果
# clean是将之前生成的文件清空,重新渲染
# 默认HTML保存在allure-report文件夹中
allure generate report --clean
界面展示如下图:
2、集成到Jenkins中
1、本地安装Jenkins,启动
2、新建item项目:Pytest_allure_demo
3、配置Jenkins:
配置Jenkins全局配置:
注:
配置完后可以用http://localhost:8080/restart重启Jenkins
配置AllureCommandline如下:
可以添加本机的安装目录或者勾选自动安装From Maven Central,然后选择一个版本,如果构建项目过程中报找不到allure,会默认从Maven Central中下载安装一个。
配置item:
使用自定义的工作空间添加项目目录:我本地项目路径为C:\pythonprojects\oh_pytest\testcases
构建处新增要执行的批处理脚本:
c:
pytest test_Pytest.py --alluredir ./report/
allure generete report --clean
exit 0
注意:
1、构建后操作,results要填写与脚本一致的文件夹名称
2、Archive the artifacts 填写index的路径,我本地的位置也是默认生成的位置是在allure-report\index.html
jenkins中环境变量的配置:
执行脚本的时候如果报pytest或者“‘allure’ 不是内部或外部命令,也不是可运行的程序或批处理文件。”可以通过设置全局的环境变量解决;如果还不行,需要pip uninstall 这些模块,cmd进入切换到power shell重新安装一下,处理一些环境变量导致的问题。
构建结果:
点击Allure Report可以查看html报告
原文链接:https://blog.csdn.net/juejiang_lovingyou/article/details/104921409
-
allure报告插件
2018-01-03 15:36:55allure报告插件,欢迎大家下载!!!!!!!!!!! -
查看allure报告
2020-12-11 11:44:37打开allure报告 在终端输入 allure open -h 127.0.0.1 -p 8083 ./Test/allure-result/html /Test/allure-result/html是我存放报告html文件所在的目录打开allure报告
在终端输入
allure open -h 127.0.0.1 -p 8083 ./Test/allure-result/html/Test/allure-result/html是我存放报告html文件所在的目录
-
allure 测试报告本地打开_pytest-allure,本地生成allure报告
2020-12-19 13:20:281。 要想结合pytest和allure在本地生成测试报告,需要安装pytest, allure(自己找资料安装)2。... 本地alluredir转为allure报告有两种方式,方法一: allure serve allure-report方法二: allure g...1。 要想结合pytest和allure在本地生成测试报告,需要安装pytest, allure(自己找资料安装)
2。 准备好脚本
3。 用pytest生成alluredir(allure-report),测试数据(里面是txt和json格式的数据文件)
4。 本地alluredir转为allure报告有两种方式,
方法一: allure serve allure-report
方法二: allure generate -o -c report allure-report # 这里的allure-report是本地生成的数据, report是我们要看的本地allure报告
报告路径report/index.html
命令行含义可以通过--help查看
apple@appledeMacBook-Pro-2 allure-reports % allure --help
Usage: allure [options] [command] [command options]
Options:
--help
Print commandline help.
-q, --quiet
Switch on the quiet mode.
Default: false
-v, --verbose
Switch on the verbose mode.
Default: false
--version
Print commandline version.
Default: false
Commands:
generate Generate the report
Usage: generate [options] The directories with allure results
Options:
-c, --clean
Clean Allure report directory before generating a new one.
Default: false
--config
Allure commandline config path. If specified overrides values from
--profile and --configDirectory.
--configDirectory
Allure commandline configurations directory. By default uses
ALLURE_HOME directory.
--profile
Allure commandline configuration profile.
-o, --report-dir, --output
The directory to generate Allure report into.
Default: allure-report
serve Serve the report
Usage: serve [options] The directories with allure results
Options:
--config
Allure commandline config path. If specified overrides values from
--profile and --configDirectory.
--configDirectory
Allure commandline configurations directory. By default uses
ALLURE_HOME directory.
-h, --host
This host will be used to start web server for the report.
-p, --port
This port will be used to start web server for the report.
Default: 0
--profile
Allure commandline configuration profile.
open Open generated report
Usage: open [options] The report directory
Options:
-h, --host
This host will be used to start web server for the report.
-p, --port
This port will be used to start web server for the report.
Default: 0
plugin Generate the report
Usage: plugin [options]
Options:
--config
Allure commandline config path. If specified overrides values from
--profile and --configDirectory.
--configDirectory
Allure commandline configurations directory. By default uses
ALLURE_HOME directory.
--profile
Allure commandline configuration profile.
-
allure 报告优化与 Jenkins中生成allure
2021-01-26 19:34:50通过命令行跑开启程序跑用例并生成allure报告文件:pytest --alluredir=allure_report 通过main函数:pytest.main(["--alluredir","allure_report"]) 2. 生成allure测试报告 allure serve allure_report 3. 优化... -
allure报告环境搭建
2021-02-28 21:46:331、安装JDK ...3、解压allure.zip到一个文件目录中 4、将allure报告安装目录\bin所在的路径添加到环境变量path中 5、安装 allure-pytest pip install allure-pytest 6、cmd输入 pip list 验证是否安装成功 ... -
本地查看allure报告及allure注解关系说明
2020-10-23 11:20:40如何在本地生成、查看allure报告。 -
jenkins配置allure环境,生成allure报告
2021-02-01 17:44:58jenkins配置allure环境,生成allure报告 环境准备 : 1:虚拟机安装allure,allure配置好环境变量 2:jenkins 运行起来 3:虚拟机安装 JDK 4:虚拟机安装 git 1.进入系统管理 —>插件管理下载好 allure,当前我是... -
如何安装配置Allure并在本地生成Allure报告
2021-01-27 15:03:15如何安装配置Allure并在本地生成Allure报告 Allure下载地址 https://github.com/allure-framework/allure2 点击Download.ZIP -
allure报告打开为loading状态
2020-11-20 23:10:45生成测试报告命令 python3 -m pytest --alluredir=../unit/allure_result test_...allure报告打开一切顺利!!! 在jenkins中把报告打包通过附件发送到邮件,然后在邮件中下载解压打开就会出现如下情况 二、问 -
HttpRunner输出allure 报告
2021-03-02 20:08:31HttpRunner输出allure 报告 1.安装allure Mac: brew install allure Windows:https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.12.0/ 下载后解压,进入bin目录,使用allure.... -
pytest+allure+jenkins,生成allure报告
2020-03-17 14:29:091、本地生成allure报告 1、安装依赖 allure-2.13.2 allure-pytest-2.8.11 pytest-5.4.1 python-jenkins jdk-1.8 2、安装后验证安装是否成功 pip list 3、配置环境变量 jdk-1.8 pytest-5.4.1 allure-2.13.2 4、... -
allure报告的定制化
2020-11-11 18:29:47最近在定制化allure报告,一个testcase函数会测试很多条用例,而每条用例的级别不一样,就发现一个可以利用@pytest.mark.parametrize循环传参进行控制allure报告的方法,分享一下 第一种方法:写在函数里面(推荐)... -
jenkins生成allure报告失败,原因:安装allure commandline失败
2020-10-14 13:54:24jenkins构建生成allure报告失败,生成allure报告配置如下:运行后报错如下: Unpacking ... -
Allure报告与jenkits集成
2019-09-23 18:05:07Allure报告 1、pytest插件安装安装 pip install allure-pytest 2、allur安装 ①https://docs.qameta.io/allure/#_pytest下载安装包 解包 运行bin目录下 .bat文件 一定到放在根目录,下面路径格式即可 ②配置... -
Jenkins持续集成allure报告
2020-11-09 12:36:54之前说过了本地生成allure报告的,今天就来说说使用Jenkins集成allure那些事。 安装allure插件 安装Jenkins 本小节来自廖雪峰Jenkins博客 首先,我们从Jenkins官方网站https://jenkins.io/下载最新的war包。... -
pytest添加附件到allure报告上
2020-05-03 13:49:03import allure import pytest def test_allure_print(): print("测试print在allure报告上") print("测试截图附件在allure报告上") with open("attach.png", "rb") as f: context = f.read() allure.a... -
自定义allure报告左上角logo
2021-01-24 17:45:20默认的allure报告不够个性化,如何装逼呢? 1.进入allure安装目录如:allure-2.10.0\plugins\custom-logo-plugin\static下 2.保存所需替换logo至该目录下(最好svg文件格式) 3.编辑style.css如(需要根据自己logo... -
jenkins-生成Allure报告(Allure Jenkins Plugin)(八)
2020-04-07 15:14:19jenkins上集成allure的报告才是高大上的,jenkins集成了allure插件,安装插件后运行pytest+allure的脚本即可在jenkins上查看allure报告了。 allure安装 在运行代码的服务器本机,我这里是用的docker容器,在容器... -
python allure报告_Pytest+Allure 定制报告
2021-02-09 01:04:21前言:最近在研究接口自动化的框架,好的测试报告在整个测试框架起到至关重要...先上一张报告效果图:python 版本及必要库python 3.5pytest 3.3.3pytest-allure-adaptor 1.7.9一、环境配置安装 Python 依赖库:pip3... -
Jenkins中allure报告的详细配置
2020-12-28 10:04:53Jenkins中allure报告的详细配置 插件管理中下载allure插件 全局配置中新增allure配置,需下载allure-command,路径无需到bin目录 系统属性中也增加allure配置 工程项目中增加脚本执行命令,alluredir后的路径... -
pytest中allure报告用例标题显示优化
2021-02-25 23:22:55如下,正常情况,生成的allure报告用例标题中,显示的是函数名称,不太直观,那么如何定制显示自己设定的中文用例标题呢?看下面 import allure import pytest class TestTitle: def test_title01(self): pass ... -
6-用例定制化执行+Allure报告-V8.3-20210122.pdf
2021-01-27 10:11:446-用例定制化执行+Allure报告-V8.3-20210122.pdf -
生成allure报告
2020-09-25 15:08:45文章目录 1. 安装pytest pytest是python的一个第三方单元测试框架,在这里用于生成原始的执行... allure-pytest基于pytest的原始执行结果生成适用于allure的json格式结果。该json格式结果可以用于后续适用allure.. -
jenkins配置并生成allure报告
2020-08-17 20:36:08在配置jenkins上生成allure报告时,踩了很多的坑,最深的坑就是页面找不到报告数据,但控制台又提示报告已生成,其实归根结底就是报告路径的问题。如下图展示: 最初也是在网上查阅了很多资料,给的解决办都是法... -
mac使用allure_mac 上构建 Jenkins+allure 报告时,一直报错
2020-12-21 11:52:26背景描述:1、主服务 ...现状:在mac上独立使用 pytest test_zbl.py --reruns 3 --alluredir=reports 、allure generate --clean reports 可以生成allure报告。但Jenkins上使用allure模块,报错,求解。ERROR: Ste... -
allure报告定制(pytest+jenkins)
2019-04-09 18:00:00要让allure报告更漂亮,更直观,需要在脚本中写入allure特性 一开始allure调用step()、story()、feature()等总是报错,提示不存在这些方法。 @allure.feature('ceshi') 警告信息: 通过查看allure的__init__... -
Python + allure 报告
2019-06-14 14:24:39Windows安装allure需要先安装scoop,确保安装了PowerShell 5(或更高版本,包括PowerShell Core)和. net Framework 4.5(或更高版本)。然后打开PowerShell运行: iex (new-object net.webclient).downloadstring('...