-
-
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
'TestEngine with ID 'junit-jupiter' failed to discover tests' on bump from 5.11.4 to 5.12.0 #4335
Comments
You may want to look at these items:
|
My bad , closing of dependabot's PR , removed branch.
Let me investigate this approach. |
I had the same issue
I already use |
@iProdigy FWIW, not specifying a |
@romani I did a little digging. It seems in your case the wrong version of
Surefire even resolves the 1.12.0 version of it, but then ends up using 1.11.2 because it's already on the test runtime classpath. Using the BOM is the right solution in this case and generally recommended. |
* Bump org.junit:junit-bom from 5.11.4 to 5.12.0 Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.11.4 to 5.12.0. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](junit-team/junit5@r5.11.4...r5.12.0) --- updated-dependencies: - dependency-name: org.junit:junit-bom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Add required dependency on junit-platform-launcher See junit-team/junit5#4335 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jerome Prinet <jprinet@gradle.com>
If you are using maven, then https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter/5.12.0 does not contain the junit-platform-launcher as dependency. And you will run into this issue when upgrading from 5.11.4 to 5.12.0. |
@robseidel do you have a more precise reproducer? As currently reported using the |
Aligning the boms is not the issue. You need the dependency junit-platform-launcher in your dependency tree, to get OutputDirectoryProvider initialized correctly. In my project I had used before this dependency, regard to the documentation and example:
After updating the version, I'll run into this very issue. The solution is to add the junit-platform-launcher:
|
Maven Surefire will automatically add |
@robseidel I suspect your project is pulling in a different version of |
I'm pretty sure it depends on my surefire configuration. Thats something like:
I've update the versions (3.5.2), but it seems surefire downloaded the wrong launcher version in my case:
I've tested in an empty project and as you wrote, surefire downloaded the correct launcher. I'm now using the launcher dependency directly as I don't know how I can influence the downloaded version in case of surefire gets the dependency. Thnx a lot for the information about how the launcher gets downloaded by surefire. |
Declaring a dependency on |
AFAIK that shouldn't be necessary. @robseidel Could you please removing that dependency? |
@mpkorstanje thnx a lot. This was a relict from some previous projects where Junit4 tests run beside Junit5 tests. I've removed it and now it uses the correct version. Thnx a lot for you help. You're awesome. |
Add runtime dependency to "org.junit.platform:junit-platform-launcher" as per junit-team/junit5#4335 (comment) Signed-off-by: Violeta Georgieva <violeta.georgieva@broadcom.com>
Add runtime dependency to "org.junit.platform:junit-platform-launcher" as per junit-team/junit5#4335 (comment) Signed-off-by: Violeta Georgieva <violeta.georgieva@broadcom.com>
@marcphilipp I’m aware that Gradle 8 included this change, but I couldn’t figure out why upgrading JUnit to 5.12 specifically caused this behavioral difference. If this were caused by upgrading Gradle, I would understand, but what exactly in JUnit 5.12 led to this change? |
Previously, Gradle added the dependency behing the scenes, however it has been deprecated since 8. Now we should add the dependency explicitly. See junit-team/junit5#4335 (comment)
Previously, Gradle added the dependency behing the scenes, however it has been deprecated since 8. Now we should add the dependency explicitly. See junit-team/junit5#4335 (comment) Signed-off-by: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Without an explicit dependency on var launcherVersion = Class.forName("org.junit.platform.launcher.Launcher").getPackage().getImplementationVersion();
System.out.println("launcherVersion = " + launcherVersion);
Class.forName("org.junit.platform.engine.TestEngine").getPackage().getImplementationVersion();
System.out.println("engineVersion = " + engineVersion); It prints:
That only worked because 1.9.x, 1.10.x, and 1.11.x were fully compatible with each other. However, it's not something we officially support and was bound to break at some point. It's also the reason for Gradle 8 having deprecated not declaring an explicit dependency on In JUnit 5.12 (which corresponds to Platform version 1.12) a new API ( |
PR to improve our docs: |
from checkstyle/checkstyle#16393
Steps to reproduce
git clone git@github.com:checkstyle/checkstyle.git
cd checkstyle
git checkout dependabot/maven/junit.version-5.12.0
mvn clean test
Context
Deliverables
The text was updated successfully, but these errors were encountered: