Copilot commented on code in PR #3653:
URL: https://github.com/apache/maven-surefire/pull/3653#discussion_r4749318597


##########
surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java:
##########
@@ -257,6 +266,31 @@ private void reportAbortedClass(
         }
     }
 
+    /**
+     * A method container, like a {@code @ParameterizedTest} or a {@code 
@TestFactory}, none of whose invocations got
+     * registered. Invocations that did run were reported on their own, so the 
container must not be counted again.
+     * Neither must it when a dynamic container inside it was already counted.
+     */
+    private boolean isMethodContainerWithoutTests(TestIdentifier 
testIdentifier) {
+        TestPlan currentTestPlan = testPlan;
+        return 
testIdentifier.getSource().filter(MethodSource.class::isInstance).isPresent()
+                && (currentTestPlan == null
+                        || 
currentTestPlan.getDescendants(testIdentifier).stream()
+                                .noneMatch(d -> d.isTest() || 
countedAbortedContainers.contains(d.getUniqueId())));

Review Comment:
   If a method-sourced dynamic container fails before registering any tests and 
its enclosing factory then aborts, this check adds a skipped test on top of the 
reported error. The failed descendant is neither a test nor in 
`countedAbortedContainers`. Also exclude descendants recorded in `failures`, 
and add a failed-child variant of 
`abortedFactoryIsNotCountedAgainAfterItsAbortedDynamicContainer`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to