Copilot commented on code in PR #3653:
URL: https://github.com/apache/maven-surefire/pull/3653#discussion_r4749226571
##########
surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java:
##########
@@ -257,6 +266,29 @@ 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())));
+ }
+
+ /**
+ * Outside a rerun, or when this very container failed before. A container
rerun only for one of its
+ * invocations wasn't counted in the first run, so it isn't counted on the
rerun either.
+ */
+ private boolean isRerunForItself(TestIdentifier testIdentifier) {
+ return runMode != RERUN_TEST_AFTER_FAILURE
+ || rerunTestIds.isEmpty()
+ ||
rerunTestIds.contains(UniqueId.parse(testIdentifier.getUniqueId()));
Review Comment:
This exact-ID check suppresses aborted method containers when an enclosing
class is the rerun target. If `@BeforeAll` fails initially, then succeeds on
retry but a parameterized method's arguments source aborts, `rerunTestIds`
contains the class ID and the method produces no skipped entry. Accept
containers whose IDs have a failed target as a prefix, while still excluding
containers rerun only for a failed descendant invocation.
--
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]