Repository navigation
[SUREFIRE-3446] Fix direct selection of JUnit Jupiter @Nested classes - #3447
Merged
Merged
Conversation
The direct selection of a JUnit Jupiter @nested class runs no tests on current master, although the same selection runs with Surefire 3.5.4. Refs apache#3446
Allow the actual enclosing class hierarchy through JUnit Platform class-name filters so a directly selected @nested class can be discovered without broadening test execution. Derive that hierarchy from Class metadata rather than binary-name parsing, and cover ordinary, regex, multi-level lifecycle, sibling, and legal dollar-sign cases. Fixes apache#3446
Contributor
Author
This is a failure to download Maven artifact. |
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.
Direct selection of a non-static JUnit Jupiter
@Nestedclass stoppeddiscovering tests after provider-level class-name filters were added. JUnit
needs the enclosing class hierarchy to construct the selected nested test, but
an exact include for the leaf class rejected those enclosing descriptors.
This change derives the actual enclosing hierarchy from
Classmetadata andallows those classes through the include filters. It deliberately does not
infer nesting from
$in the binary name, because$is also legal in atop-level class name. Existing post-discovery filtering continues to prevent
tests in the enclosing classes or sibling nested classes from running.
The regression coverage includes ordinary and regex includes, a legal
top-level class containing
$, and a two-level nested selection whose outerand intermediate
@BeforeEachcallbacks must both run. Tests in the outer,intermediate, and sibling classes fail if selection leaks beyond the requested
leaf.
Fixes #3446
Following this checklist to help us incorporate your
contribution quickly and easily:
mvn clean installto make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
mvn -Prun-its clean install).Validation performed with JDK 17:
mvn spotless:apply spotless:checkmvn -pl surefire-providers/surefire-junit-platform clean install(99 tests)mvn -Prun-its -pl surefire-its -Dit.test=Surefire3446IT clean verifymvn -nsu -Dmaven.build.cache.enabled=false -Prun-its clean install(17-module reactor; 776 integration tests, 0 failures, 0 errors)
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.