Fix nested test class failure detection and version bump to 1.15.#34
Open
Fix nested test class failure detection and version bump to 1.15.#34
Conversation
When test classes use JUnit 5 @nested inner classes, surefire generates separate XML reports with class names like OuterTest$InnerTest. The plugin was failing to detect these failures because the nested class name didn't match entries in allTestClasses (which excludes $-classes). The fix resolves nested class names to their outer class before building the retry command. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
The previous fix mapped nested class names to the outer class, but surefire cannot find test methods that only exist in nested classes when filtering by the outer class name. Keep the full $NestedClass name in -Dtest so surefire can locate the methods, while still using the outer class for tracking in allTestClasses/incompleteTests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Surefire 3.x puts nested @nested class tests in the outer class XML report with a display name as classname, not the FQCN. The -Dtest filter cannot target methods inside nested classes by name, so when a nested class test fails, rerun the entire outer class instead of filtering by method. Also fix NPE when parsing testcase elements with no failure/error children. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
judepereira
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug where test failures in JUnit 5
@Nestedinner classes were not retried by the supertest plugin.Root cause: Surefire 3.x reports nested class test cases inside the outer class's XML report, but uses the
@DisplayName(e.g.,"AddNumbers Method Tests") as theclassnameattribute instead of the FQCN. The plugin was building a retry command like-Dtest=OuterClass#nestedMethod*, but surefire's-Dtestfilter cannot locate methods that only exist inside nested classes when filtering by the outer class name — resulting inTests run: 0on retry.Fix:
SurefireReportParsernow detects nested class failures by comparingtestcase/@classnameagainsttestsuite/@name-Dtest=OuterClassinstead of-Dtest=OuterClass#method*), since surefire has no way to target individual methods inside nested classestestcasechild nodes to prevent NPE on test cases with no failure/error elementscreateRerunCommandusesgetOuterClassName()to correctly track nested class reports (from other surefire versions that generate separate$-prefixed XMLs) againstallTestClasses, which excludes inner classes via**/*$*Version bumped to 1.15.
Test plan
NestedInnerTest.xmltest fixture matching real surefire 3.5.4 output format (nested class tests with display name as classname)createRerunCommandWithNestedTestClassFailuretest verifying entire outer class is reruntestGetOuterClassNameunit test