Junit5在Junit4的基础上实现了许多新的功能,相对于Junit4,Junit5在自动测试实现上已经相当完善了;可以预见,在未来10年,java自动化测试领域将会是Junit5和TestNG双雄交替的局面了.
allure2用户手册:Allure Framework
1.从allure2用户手册进入junit5章节可知,maven项目中的pom.xml中需添加如下依赖才能使用allure2:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>junit5Test</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<aspectj.version>1.8.0_211</aspectj.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
2.下载allure-commandline:Central Repository: io/qameta/allure/allure-commandline/2.13.3---->allure-commandline-2.13.3.zip
??
3.待pom中的依赖下载完毕后,执行命令:mvn test(mvn命令必须在pom.xml所在目录中执行) ,执行完毕后会生成allure-results目录
?4.allure-commandline下载后解压,windows双击解压后的bin目录中的allure.bat(另一个适用于Mac或Linux)
5.然后终端中运行命令allure serve allure-results,就会生成aluure报告了.
|