jenkins学习之配置allure单元测试可视化报告

1.登录jenkins安装allure插件

在这里插入图片描述

2.配置全局工具allure commandline
在这里插入图片描述

3.本地测试

3.1安装allure

进入Allure官网http://allure.qatools.ru/ ,点击右上角DownLoad进入下载页面,下载zip文件。
在这里插入图片描述
解压zip文件,配置path

D:\myprogram\allure-commandline-2.13.5\allure-2.13.5\bin

执行bat文件
在这里插入图片描述

3.2给项目添加依赖

		<!--allure的testng插件-->
		<dependency>
			<groupId>ru.yandex.qatools.allure</groupId>
			<artifactId>allure-testng-adaptor</artifactId>
			<version>1.3.6</version>
			<exclusions>
				<exclusion>
					<groupId>org.testng</groupId>
					<artifactId>testng</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<!-- 依赖Guice -->
		<dependency>
			<groupId>com.google.inject</groupId>
			<artifactId>guice</artifactId>
			<version>4.0</version>
		</dependency>

		<dependency>
			<groupId>io.qameta.allure</groupId>
			<artifactId>allure-testng</artifactId>
			<version>2.0-BETA14</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.testng</groupId>
			<artifactId>testng</artifactId>
			<version>6.11</version>
		</dependency>

		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-surefire-plugin</artifactId>
			<version>2.20</version>
			<configuration>
				<argLine>
					-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
				</argLine>
				<!--生成allure-result的目录-->
				<systemProperties>
					<property>
						<name>allure.results.directory</name>
						<value>./target/allure-results</value>
					</property>
				</systemProperties>
			</configuration>
			<dependencies>
				<dependency>
					<groupId>org.aspectj</groupId>
					<artifactId>aspectjweaver</artifactId>
					<version>${aspectj.version}</version>
				</dependency>
			</dependencies>
		</plugin>

3.3编写测试类

package com.example.demo;


import org.springframework.boot.test.context.SpringBootTest;
import org.testng.Assert;
import org.testng.annotations.Test;
import io.qameta.allure.Epic;



@SpringBootTest
class SpringbootHelloApplicationTests {

    @Epic("测试大目录一")
    @Test
    public void Test(){
        int a = 9;
        int b = 3;
        assert (a+b == 11);
    }
    
    @Epic("测试大目录二")
    @Test
    public void Test2(){

        int a = 9;
        int b = 3;
        Assert.assertEquals(a,b);
    }
}

3.4执行命令 mvn clean test 生成allure-results
在这里插入图片描述

3.5执行命令allure serve target/allure-results
在这里插入图片描述
在这里插入图片描述
4.jenkins测试
在这里插入图片描述

在这里插入图片描述
查看报告
在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值