-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JUnit Jupiter 5.12 fails to find tests with Maven Surefire #4341
Comments
I included on the classpath which enabled my tests to pass.
|
Please assign a milestone to this issue or label it with |
Please assign a milestone to this issue or label it with |
Please assign a status label to this issue. |
@cbm64chris (any anyone else with the same issue) the recommend solution is to use the junit-bom to align dependency versions as recommended by the user guide. This also works on transitive dependencies. You also don't have to declare a dependency on |
@mpkorstanje Should this also work for Gradle? I followed the user guide - which specifies to have
Unfortunately, afterwards the error persists. 🤷 |
had to replace
by
to make this version work |
@marcphilipp for Gradle there is a difference between what JUnit and Gradle documentation recommends.
And only the synthesis of both seems to be working. The JUnit docs did not catch the requirement to declare the test framework implementation with Gradle 8, while the Gradle docs did not include the use of the BOM. |
Please assign a milestone to this issue or label it with |
Using the BOM is not necessary for Gradle because the Gradle Module Metadata that is published as part of all JUnit 5 artifacts automatically pulls in the BOM. Therefore this should work: testImplementation("org.junit.jupiter:junit-jupiter:5.12.0")
testImplementation("org.junit.platform:junit-platform-launcher") |
I've created #4343 to improve the Gradle section in our User Guide to reflect the requirement introduced in Gradle 8. |
Upgrading from
junit-jupiter-api:5.11.4
andjunit-platform-commons:1.11.4
to 5.12.0 and 1.12.0 respectively causes: "TestEngine with ID 'junit-jupiter' failed to discover tests”.The
pom.xml
in my project contains;junit-platform-commons
is transitive.mockito-junit-jupiter:5.15.2
is included which brings inmockito-core
at the same version.I include surefire with 5.12.0 engine.
UnitTests
is a@Tag("UnitTests”)
on the classes.The error is thrown:
Adding
junit-platform-engine:1.12.0
to the classpath produces the same outcome but a different cause;The project is JDK 11 running maven 3.9.9.
My project runs on Jenkins with a renovate GitHub app pulling in updates for PR. All projects with 5.12.0 fail with the same error.
Steps to reproduce
mvn clean test
Context
Deliverables
The text was updated successfully, but these errors were encountered: