Skip to content

fix: add @suite support on junit 5#1846

Merged
wenytang-ms merged 3 commits intomainfrom
wenyt/suite
Mar 5, 2026
Merged

fix: add @suite support on junit 5#1846
wenytang-ms merged 3 commits intomainfrom
wenyt/suite

Conversation

@wenytang-ms
Copy link
Contributor

@wenytang-ms wenytang-ms commented Mar 5, 2026

#1828
However, getTestId() only recognizes engine:junit5, engine:junit-jupiter, and engine:jqwik, causing Suite's uniqueId to be incorrectly routed to getTestIdForNonJunit5Method(), resulting in an incorrect test ID being parsed → triggeredTestsMapping failed to match → testItem is undefined → all UI updates are silently discarded.

Two files were modified, with three changes:
constants.ts:76 — Added the constant SUITE = 'suite:' to JUnitTestPart
JUnitRunnerResultAnalyzer.ts:194 — Added engine:junit-platform-suite identification to getTestId()
JUnitRunnerResultAnalyzer.ts:224 — Handled the suite: part in getTestIdForJunit5Method(), using the suite name as the className when class: is not specified (this will override any subsequent class: entries to ensure correct subtest IDs).

Also add unit test case for this fix.

Copy link

Copilot AI left a 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 addresses #1828 by improving how JUnit runner output is mapped back to VS Code TestItems when executing JUnit 5 @Suite tests (from junit-platform-suite), so suite containers can be identified correctly and have their status reflected in the Test Explorer.

Changes:

  • Extend JUnit 5 unique-id parsing to recognize engine:junit-platform-suite and the suite: segment.
  • Add a JUnit 5 @Suite sample class and corresponding Maven dependency in the junit test project.
  • Add a unit test intended to cover @Suite execution output handling.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/test-projects/junit/src/test/java/junit5/suite/MyTestSuite.java Adds a JUnit 5 @Suite fixture for reproduction/coverage.
test/test-projects/junit/pom.xml Adds junit-platform-suite dependency for suite engine support in test project.
test/suite/JUnitAnalyzer.test.ts Adds a new test case targeting suite runner output handling.
src/runners/junitRunner/JUnitRunnerResultAnalyzer.ts Updates test id extraction to handle junit-platform-suite / suite: unique-id segments.
src/constants.ts Adds JUnitTestPart.SUITE constant used by the analyzer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@wenytang-ms wenytang-ms merged commit b8d3098 into main Mar 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants