So. You try to write junit tests with jupiter, but maven seems to ignore them silently? I've had this problem come and go over the last few years and I've finnally gotten closer to how to fix this.
There are numerous threads about this out there but I've never seems a definitive answer on how to fix it. But here's what it boils down to: The combination of 2 dependencencies and a plugin.
The maven-surefire-plugin should be of version: maven-surefire-plugin:3.0.0-M3
The plugins junit-jupiter-engine and junit-jupiter-api must be of the same version.
And here's the way to check that:
$ mvn dependency:tree | grep junit [INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.3.2:test [INFO] | +- org.junit.platform:junit-platform-engine:jar:1.6.2:test [INFO] | \- org.junit.jupiter:junit-jupiter-api:jar:5.3.2:test [INFO] +- org.junit.platform:junit-platform-commons:jar:1.5.2:test
Make sure you get the correct versions by using a dependency management in your root pom!
Additionally
- It seems to be irrelevant with variations on versions on other dependencies.
- If you have problems with eclipse you might need to add vintage engine, but this might cause your tests to stop running again!