- Notifications
You must be signed in to change notification settings - Fork 558
Open
Labels
bugSomething isn't workingSomething isn't workingpriority:minorMinor loss of function, or other problem where easy workaround is presentMinor loss of function, or other problem where easy workaround is present
Description
Jochen Kraushaar opened SUREFIRE-2194 and commented
Example Test Class
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); } } }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.
Actual Result
TEST-ExampleTest.xmldoes not contain any test case.TEST-ExampleTest$InnerExampleTest.xmlcontains results for both test cases.
Workaround
Do not put any tests into the parent class if nested classes are used.
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.
Affects: 3.1.2
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpriority:minorMinor loss of function, or other problem where easy workaround is presentMinor loss of function, or other problem where easy workaround is present