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


##########
surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java:
##########
@@ -437,10 +428,9 @@ private SimpleReportEntry createReportEntry(
                 && testExecutionResult.getStatus() != 
org.junit.platform.engine.TestExecutionResult.Status.SUCCESSFUL
                 && testIdentifier.isContainer()
                 && methodName == null) {
-            // BeforeAny tests ran → setup failure; after tests succeeded → 
teardown failure.
-            // Distinguishing them keeps AfterAll/AfterClass errors from being 
misclassified as
-            // flaky BeforeAll failures (#3412 / regression since 3.5.5).
-            if (className != null && 
classesWithSuccessfulTests.contains(className)) {
+            // Before any of its own tests started it's a setup failure, after 
that a teardown failure.
+            // Only this container's tests count: a passing outer test says 
nothing about a nested class.
+            if 
(classContainersWithStartedTests.contains(testIdentifier.getUniqueId())) {

Review Comment:
   When an outer test passes but a nested `@BeforeAll` fails on every retry, 
this change labels the unresolved failure `initializationError`. 
`DefaultReporterFactory` and `StatelessXmlReporter` infer recovery from any 
successful method under the shared outer-class name, so the earlier outer 
success turns the failure into a flake and can allow the build to succeed. 
Track recovery for the specific failed container in both reporting paths, and 
add an integration case that remains an error when nested setup never recovers.



-- 
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