我需要使用 junit 5 和 junit 4 的依赖项是什么?
what are the Dependencies that i need to use junit 5 and junit 4?
因为我是 Junit 5 的新手,我读到它们现在在 Junit 5 中是分开的,所以我需要附加什么?
我正在查看 maven 存储库,我发现 junit 5 有很多依赖项,我不知道在 Junit 5 中运行 Junit 4 测试应该包括什么,以及单独的 Junit 5 是什么?
我还没有代码,但只需要依赖项来理解我的内容
需要下载
surefire 对所有这些都有什么作用?
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.0-M4</version>
</dependency>
更新 - 所以 surefire 是为了搜索丢失的依赖项,
有什么用?
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.4.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.4.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite-api</artifactId>
<version>1.4.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.4.0-M1</version>
<scope>test</scope>
</dependency>
Question: what the surefire does for all of these?
如果在 POM.xml 中没有很好地提及您的依赖项,那么 Surefire 会检测要使用的 JUnit 版本。
Surefire 支持 3 个不同版本的 JUnit:JUnit 3.8.x、JUnit 4.x(串行provider) 和 JUnit 4.7(具有并行支持的 junit-core provider)
算法的工作原理如下:
if the JUnit 5 Platform Engine is present in the project
use junit-platform
if the JUnit version in the project >= 4.7 and the <<<parallel>>> configuration parameter has ANY value
use junit47 provider
if JUnit >= 4.0 is present
use junit4 provider
else
use junit3.8.1
编辑:Junit 5 所需的依赖项: ref1 , ref2
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
因为我是 Junit 5 的新手,我读到它们现在在 Junit 5 中是分开的,所以我需要附加什么?
我正在查看 maven 存储库,我发现 junit 5 有很多依赖项,我不知道在 Junit 5 中运行 Junit 4 测试应该包括什么,以及单独的 Junit 5 是什么?
我还没有代码,但只需要依赖项来理解我的内容 需要下载
surefire 对所有这些都有什么作用?
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.0-M4</version>
</dependency>
更新 - 所以 surefire 是为了搜索丢失的依赖项, 有什么用?
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.4.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.4.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite-api</artifactId>
<version>1.4.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.4.0-M1</version>
<scope>test</scope>
</dependency>
Question: what the surefire does for all of these?
如果在 POM.xml 中没有很好地提及您的依赖项,那么 Surefire 会检测要使用的 JUnit 版本。
Surefire 支持 3 个不同版本的 JUnit:JUnit 3.8.x、JUnit 4.x(串行provider) 和 JUnit 4.7(具有并行支持的 junit-core provider)
算法的工作原理如下:
if the JUnit 5 Platform Engine is present in the project
use junit-platform
if the JUnit version in the project >= 4.7 and the <<<parallel>>> configuration parameter has ANY value
use junit47 provider
if JUnit >= 4.0 is present
use junit4 provider
else
use junit3.8.1
编辑:Junit 5 所需的依赖项: ref1 , ref2
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>