我正在尝试使用命令mvn test
在Maven上执行我的JUnit5测试。我在pom上添加了maven-surefire-plugin,如下所示:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
我的测试分为四个类,分别为:
IOTest.java
OperationTest.java
TaskTest.java
UtilityTest.java
这些测试是从Eclipse正确执行的,但是当我使用mvn test
从shell运行它们时,仅执行了用@Test
注释的那些,而用@ParameterizedTest
注释的那些则似乎不可见。 / p>
答案 0 :(得分:0)
我认为您缺少作用域,请尝试在依赖项中添加作用域,如下所示
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>