-
Notifications
You must be signed in to change notification settings - Fork 163
feat: junit 6 support #1820
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
feat: junit 6 support #1820
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds JUnit 6 support to the Java test runner extension, extending the framework to handle the next major version of JUnit Jupiter. The implementation follows the existing JUnit 5 pattern by adding a new TestKind enum value and implementing corresponding searcher and finder classes.
Key Changes:
- Added
JUnit6enum value toTestKindacross TypeScript and Java codebases - Implemented
JUnit6TestSearcherandJUnit6TestFinderclasses for test detection - Updated conditional logic throughout to handle JUnit 6 alongside JUnit 5
- Updated dependencies to include JUnit 6 artifacts (versions 6.0.1) and upgraded JUnit 5 to 5.14.x
- Modified build scripts to support multiple JUnit versions and updated Eclipse platform target
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/java-test-runner.api.ts | Added JUnit6 enum value (3) to TestKind |
| src/utils/launchUtils.ts | Extended tag parsing condition to include JUnit6 |
| src/runners/junitRunner/JUnitRunnerResultAnalyzer.ts | Added JUnit6 runner package filter and extended display name logic for JUnit6 |
| src/controller/testController.ts | Added JUnit6 case to runner selection and test framework version tracking; minor whitespace fix |
| scripts/buildJdtlsExt.js | Updated bundle list with JUnit6 runtime and refactored updateVersion() to rebuild from actual server folder contents |
| package.json | Added JUnit 6 dependencies (6.0.1) and upgraded JUnit 5 to 5.14.1 and platform to 1.14.1 |
| java-extension/.../com.microsoft.java.test.tp.target | Updated Eclipse repository URLs to 4.38-I-builds and 2025-12 release |
| java-extension/.../JUnit6TestSearcher.java | New test searcher implementation for JUnit 6 using JUNIT_PLATFORM_TESTABLE annotation |
| java-extension/.../JUnit6TestFinder.java | New test finder implementation with JUnit 6 loader support |
| java-extension/.../TestFrameworkUtils.java | Added JUNIT6_TEST_SEARCHER constant and case in getSearcherByTestKind() |
| java-extension/.../TestGenerationUtils.java | Extended lifecycle annotations handling to include JUnit6 |
| java-extension/.../TestKindProvider.java | Added JUnit6 detection using CoreTestSearchEngine.hasJUnit6TestAnnotation() |
| java-extension/.../TestKind.java | Added JUnit6(3) enum value with fromString() and toString() support; formatting improvements |
| java-extension/.../JUnitLaunchUtils.java | Added JUNIT6_LOADER constant and case in getEclipseTestKind() |
| java-extension/.../JUnitLaunchConfigurationTemplate.java | Added projectName attribute to launch configuration template |
| java-extension/.../JUnitLaunchConfigurationDelegate.java | Extended parameter handling condition to include JUnit6 |
| java-extension/.../JUnitLaunchConfiguration.java | Added projectName to value map |
| java-extension/.../META-INF/MANIFEST.MF | Added JUnit 6 bundle dependencies and upgraded JUnit 5 versions; includes both 5.14.x and 6.0.1 versions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...java.test.plugin/src/main/java/com/microsoft/java/test/plugin/provider/TestKindProvider.java
Show resolved
Hide resolved
...va.test.plugin/src/main/java/com/microsoft/java/test/plugin/searcher/JUnit6TestSearcher.java
Show resolved
Hide resolved
...va.test.plugin/src/main/java/com/microsoft/java/test/plugin/searcher/JUnit6TestSearcher.java
Outdated
Show resolved
Hide resolved
...java.test.plugin/src/main/java/com/microsoft/java/test/plugin/provider/TestKindProvider.java
Show resolved
Hide resolved
...java.test.plugin/src/main/java/com/microsoft/java/test/plugin/searcher/JUnit6TestFinder.java
Show resolved
Hide resolved
| * to properly detect tests in JUnit 6 projects. | ||
| * | ||
| * <p><b>Why this class exists:</b> Eclipse JDT does not yet have built-in support for JUnit 6. | ||
| * This is a custom implementation that will be needed until Eclipse JDT adds official JUnit 6 support. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still expect JDT to support JUNIT 6?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, there also some issue or PR list for jdtls
- Rename JUnit5TestFinder to reflect its re-use for JUnit 6 eclipse-jdt/eclipse.jdt.ui#2620
- Add JUnit test launch config entry for JUnit 6 eclipse-jdt/eclipse.jdt.ui#2560
I think they should officially support, but currently the junit 6 is still not ready, so I think in java-test, implement such a finder for junit 6.
This is just the initial version that supports JUnit 6, and compatibility is not being considered for now.
test against with redhat/vscode-java 1.51.2025120208
https://github.com/junit-team/junit-examples/tree/main/junit-jupiter-starter-maven
https://github.com/microsoft/vscode-java-test/tree/main/test/test-projects/junit