Junit5: maven-surefire-plugin 2.21.0 does not detect JUnit tests

Created on 22 Mar 2018  路  3Comments  路  Source: junit-team/junit5

Hi, I'm trying to integrate JUnit 5 using the maven-surefire-plugin 2.21.0. But when I use that version, either JUnit5 nor JUnit4 tests are found/run.

Steps to reproduce:

git clone https://github.com/junit-team/junit5-samples.git
cd junit5-samples/junit5-maven-consumer
mvn test
... # All tests are run
vim pom.xml # change maven-surefire-plugin version to 2.21.0
mvn test
... # No tests are run

Is this behavior intended, do I miss something?

You could also add org.junit.jupiter:junit-jupiter-engine to the surefire dependencies, but it wouldn't make a difference:

<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-engine</artifactId>
    <version>${junit.jupiter.version}</version>
</dependency>

Related issue: https://github.com/junit-team/junit5/issues/809#issuecomment-330488537

Maven Surefire Platform duplicate

Most helpful comment

As @marcphilipp mentioned, the plugin (i.e., _Provider_) has already been fixed (though not yet released), and the documentation has been updated accordingly.

From snapshot User Guide:

Please use Maven Surefire 2.21.0 with the junit-platform-surefire-provider.

All 3 comments

From the User Guide:

Due to a memory leak in Surefire 2.20 and issues running on Java 9, the junit-platform-surefire-provider currently only works with Surefire 2.19.1.

However, the next release (1.2.0-M1) will work with Surefire 2.21.x, see #809. If you want, you can use the 1.2.0-SNAPSHOT version of junit-platform-surefire-provider. Otherwise, please use 2.19.1 for now.

Thanks @marcphilipp for clarification. Since the documentation only refers to 2.20, and the memory leak was fixed in 2.20.1, and the Junit5 support seems to be restored with 2.21.0, I was assuming that the plugin has been fixed. The misleading documentation should be updated then.

As @marcphilipp mentioned, the plugin (i.e., _Provider_) has already been fixed (though not yet released), and the documentation has been updated accordingly.

From snapshot User Guide:

Please use Maven Surefire 2.21.0 with the junit-platform-surefire-provider.

Was this page helpful?
0 / 5 - 0 ratings