Surefire没有拿起Junit 5测试
我用JUnit 5写了一个简单的测试方法:
public class SimlpeTest {
@Test
@DisplayName("Some description")
void methodName() {
// Testing logic for subject under test
}
}
但是当我跑步时,我得到了:mvn test
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running SimlpeTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
不知何故,surefire没有认出那个测试类。我的长相是:pom.xml
<properties>
<java.version>1.8</java.version>
<junit.version>5.0.0-SNAPSHOT</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit5-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<updatePolicy>always</updatePolicy>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
任何想法如何使它工作?