[ https://issues.apache.org/jira/browse/SUREFIRE-2194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764227#comment-17764227 ]
Michael Osipov commented on SUREFIRE-2194: ------------------------------------------ I see your point, it should be consistent. > JUnit 5: Implementing tests in test class and nested class results in > incorrect reporting > ----------------------------------------------------------------------------------------- > > Key: SUREFIRE-2194 > URL: https://issues.apache.org/jira/browse/SUREFIRE-2194 > Project: Maven Surefire > Issue Type: Bug > Components: JUnit 5.x support, Maven Surefire Plugin > Affects Versions: 3.1.2 > Reporter: Jochen Kraushaar > Priority: Minor > > h3. Example Test Class > {code:java} > import org.junit.jupiter.api.Nested; > import org.junit.jupiter.api.Test; > import static org.junit.jupiter.api.Assertions.assertTrue; > class ExampleTest { > @Test > void outerTest() { > assertTrue(true); > } > @Nested > class InnerExampleTest { > @Test > void innerTest() { > assertTrue(true); > } > } > } > {code} > h3. Expected Result > *One* {{TEST-ExampleTest.xml}} file containing the results of both tests or > *two* files ({{{}TEST-ExampleTest.xml{}}} and > {{{}TEST-ExampleTest$InnerExampleTest.xml{}}}) containing the results of > their tests. > h3. Actual Result > * {{TEST-ExampleTest.xml}} does not contain any test case. > * {{TEST-ExampleTest$InnerExampleTest.xml}} contains results for both test > cases. > h3. Workaround > Do not put any tests into the parent class if nested classes are used. > h3. Analysis > {{org.apache.maven.surefire.junitplatform.RunListenerAdapter}} does not > distinguish between the parent and the nested classes. Both are reported as > new test sets. > {{org.apache.maven.plugin.surefire.report.TestSetRunListener}} does not > support nested test sets, so the test set of the nested class overrides the > test set of the parent class. -- This message was sent by Atlassian Jira (v8.20.10#820010)