我有一个工作环境,包括bom,我不管理,并且JUnit5测试不会被捕获,除非我从import org.junit.Test;导入测试方法的@Test注释,如果我从import org.junit.jupiter.api.Test;导入它们,它们不会被maven surefire插件捕获。我阅读了许多部分,并在一个较小的项目及其工作和纠偏中进行了测试,我不知道在这篇文章中包含了什么内容,这样您就有了足够的信息来了解问题的所在。另外,如果有人可以解释一下我所读到的导入的引擎盖下面是什么,那么JUnit 4和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
结束
发布于 2022-04-06 16:32:01
发现这种依赖冲突,消除它解决了我的问题。
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.8.2</version>
<scope>test</scope>
</dependency>还更新了2.6.6的spring-boot依赖版本,并与2.3.3.RELEASE发生了问题。
https://stackoverflow.com/questions/71767721
复制相似问题