自动化测试的三种报告输出 reportng & allure_Report & extent _Report

本文介绍了自动化测试中的三种报告工具:reportng,Allure Report 和 extent_Report。reportng是一个较老的报告格式,可以通过修改源文件调整样式。Allure Report需配置环境变量,能生成公网可访问的报告。extent_Report则需执行监听,支持自定义标题和失败截图,当官网不可用时,可下载CSS文件到本地使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.reportng

1 需要引入jar包 报告的格式简单 比较古老 可以修改源文件更改样式
一般不用
2 源码地址: https://github.com/dwdyer/reportng
3 添加依赖:

<!-- https://mvnrepository.com/artifact/org.uncommons/reportng -->
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.4</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.guice/guice -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
</dependency>
//再增加如下
<suiteXmlFiles>
<!--指定要执行的testngXml路径 -->
<suiteXmlFile>testng.xml</suiteXmlFile></suiteXmlFiles>			<testFailureIgnore>true</testFailureIgnore>
<argLine>-Dfile.encoding=UTF-8</argLine>
<systemPropertyVariables>
<org.uncommons.reportng.escapeoutput>false</org.uncommons.reportng.escape-output>
</systemPropertyVariables>
</configuration>

2.Allure Report

需要下载allure的包 再配置Allure 的环境变量 导入jar包依赖
会生成公网地址的报告,都可以访问
环境变量配置:
Path后追加allure的bin目录文件路径
在cmd中进入项目文件路径 输入allure serve即可生成报告

 <dependency>
    <groupId>io.qameta.allure</groupId>
    <artifactId>allure-testng</artifactId>
    <version>2.13.0</version>
 </dependency>

3. extent _Report

1 导入jar包依赖
2 需要在测试执行时执行监听 监听的java文件大部分由源码提供 可以修改标题等内容 可以加入失败截图 显示测试用例的描述或测试名称 源码官网查找
3 如果extent 的官网不好, 报告的显示格式无法引用官网的css文件 可以下载到本地后 替换报告中的css文件

<dependency>
	<groupId>com.aventstack</groupId>
	<artifactId>extentreports</artifactId>
	<version>3.1.5</version>
</dependency>
<dependency>
     <groupId>org.aspectj</groupId>
     <artifactId>aspectjweaver</artifactId>
     <version>1.8.10</version>
 </dependency>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值