我有一个工作环境,包括我无法管理的bom
未进行JUnit5测试
除非我导入
@Test
来自的测试方法的注释
import org.junit.Test;
如果我从中导入
import org.junit.jupiter.api.Test;
它们并没有被maven-surefire插件所接受。
我阅读了许多部分,并在一个较小的项目中进行了测试,以及它的工作和选择,我不知道该在这篇文章中包含什么,所以你有足够的信息来了解问题所在。
此外,如果有人能解释我读到的JUnit4和5都需要使用的导入的幕后原因,即
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<!--JUnit Jupiter Engine to depend on the JUnit4 engine and JUnit 4 API -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
带有版本
<maven.surefire.version>3.0.0-M5</maven.surefire.version>
<junit-jupiter.version>5.1.0</junit-jupiter.version>
我很感激。
请注意
-
我的测试都在src/test/java/下。。。。。Java语言
-
方法是公开的
-
方法从测试开始
-
类以Test结束