Maven not running all JUnit tests

Feb 20, 2019 by Thibault Debatty | 11695 views

https://cylab.be/blog/15/maven-not-running-all-junit-tests

Here is a trick for solving a tricky and vicious maven bug...

If you are using maven to build your java project, with JUnit tests, you may encounter an error where some (or all) of your tests are not executed, without causing any error message.

The reason is that some versions of maven-surefire-plugin, the plugin used by maven to run your junit tests, do not fully support JUnit5:

https://maven.apache.org/surefire/maven-surefire-plugin/featurematrix.html

This has been fixed in maven-surefire-plugin version 2.22.0.

If you are using an autogenerated pom.xml, chance is great that you are using an older version, You can fix this issue by using the latest version of maven-surefire-plugin in your pom.xml (currently 2.22.1):

<build>
    <plugins>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.1</version>
        </plugin>
    </plugins>
</build>

This blog post is licensed under CC BY-SA 4.0

This website uses cookies. More information about the use of cookies is available in the cookies policy.
Accept