. Advertisement .
..3..
. Advertisement .
..4..
I’m using Spring Boot and Junit 5 for a straightforward project.
- My unit tests function properly when running Spring Boot 2.1 (for instance, 2.1.8 or 2.1.12).
- My unit tests give an error ”testengine with id ‘junit-jupiter’ failed to discover tests” while running Spring Boot 2.2 (for example, 2.2.2.RELEASE or 2.3.2.RELEASE).
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project XXX: There are test failures.
[ERROR]
[ERROR] Please refer to D:\Projets\workspace\XXX\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] There was an error in the forked process
[ERROR] TestEngine with ID 'junit-vintage' failed to discover tests
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] TestEngine with ID 'junit-vintage' failed to discover tests
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:656)
I’m using JUnit 5.6.0, JUnit platform 1.6.0, Maven 3.6.1, and JDK 1.8. To ensure that there are no JUnit 4 artifacts left in the dependency tree, I remove the dependence on junit:junit
from spring-boot-starter-tes
t. Because maven-surefire-plugin
2.22.2 is used by both Spring Boot 2.2 and 2.3, my issue is not a result of a maven-surefire-plugin
regression.
Can someone give me some advice?
The cause: This error happens because the dependency on
spring-boot-starter-test
brings a dependency onjunit-vintage-engine
Solution: You can fix this issue by adding the following dependency explicitly to upgrade
junit-vintage-engine