-
Notifications
You must be signed in to change notification settings - Fork 553
Closed
Labels
bugSomething isn't workingSomething isn't workingpriority:majorMajor loss of functionMajor loss of function
Description
Leonard Brünings opened SUREFIRE-2298 and commented
Given this example test you can see that the @Nested
test classes are not reported correctly. In 3.5.2 and earlier all executions land in the TEST-BaseNestedTest$Inner.xml
and with the changes in 3.5.3 they are distributed in all files. However, the nested classes belong to the enclosing class and the reporting should reflect that, so it would be more accurate to report the nested executions as part of the enclosing tests (see below).
Marc Philipp please chime in.
import org.junit.jupiter.api.*;
abstract class BaseNestedTest {
@Test
void outerTest() {
}
@Nested
class Inner {
@Test
void innerTest() {
}
}
}
class FirstNestedTest extends BaseNestedTest {
}
class SecondNestedTest extends BaseNestedTest {
}
This was most likely caused by 5aeca19
3.5.2
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" version="3.0.2" name="FirstNestedTest" time="0.019" tests="0" errors="0" skipped="0" failures="0">
</testsuite>
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" version="3.0.2" name="SecondNestedTest" time="0.004" tests="0" errors="0" skipped="0" failures="0">
</testsuite>
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" version="3.0.2" name="BaseNestedTest$Inner" time="0.001" tests="2" errors="0" skipped="0" failures="0">
<testcase name="outerTest" classname="FirstNestedTest" time="0.007"/>
<testcase name="innerTest" classname="BaseNestedTest$Inner" time="0.0"/>
<testcase name="innerTest" classname="BaseNestedTest$Inner" time="0.0"/>
<testcase name="outerTest" classname="SecondNestedTest" time="0.001"/>
</testsuite>
3.5.3
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" version="3.0.2" name="FirstNestedTest" time="0.019" tests="1" errors="0" skipped="0" failures="0">
<testcase name="outerTest" classname="FirstNestedTest" time="0.007"/>
</testsuite>
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" version="3.0.2" name="SecondNestedTest" time="0.003" tests="1" errors="0" skipped="0" failures="0">
</properties>
<testcase name="outerTest" classname="SecondNestedTest" time="0.001"/>
</testsuite>
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" version="3.0.2" name="BaseNestedTest$Inner" time="0.001" tests="1" errors="0" skipped="0" failures="0">
<testcase name="innerTest" classname="BaseNestedTest$Inner" time="0.001"/>
<testcase name="innerTest" classname="BaseNestedTest$Inner" time="0.0"/>
</testsuite>
Expected reporting
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" version="3.0.2" name="FirstNestedTest" time="0.019" tests="1" errors="0" skipped="0" failures="0">
<testcase name="outerTest" classname="FirstNestedTest" time="0.007"/>
<testcase name="innerTest" classname="BaseNestedTest$Inner" time="0.001"/>
</testsuite>
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" version="3.0.2" name="SecondNestedTest" time="0.003" tests="1" errors="0" skipped="0" failures="0">
</properties>
<testcase name="outerTest" classname="SecondNestedTest" time="0.001"/>
<testcase name="innerTest" classname="BaseNestedTest$Inner" time="0.0"/>
</testsuite>
Affects: 3.5.3
Issue Links:
- SUREFIRE-1643 JUnit 5 in parallel execution mode confuses Surefire reports
("is caused by") - SUREFIRE-2299 Missing tests inside Surefire report for Cucumber scenarios
Remote Links:
0 votes, 7 watchers
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpriority:majorMajor loss of functionMajor loss of function