MilanTyagi2004 commented on issue #3267:
URL: 
https://github.com/apache/maven-surefire/issues/3267#issuecomment-4073350755

   Hi Olamy,
   
   I looked into this issue and was able to reproduce the behavior. The root 
cause seems to be tied to the JUnit lifecycle - when `@BeforeAll` fails, no 
test methods are executed, so Surefire ends up creating a `<testcase>` entry 
without a method name.
   
   A possible approach to fix this would be:
   
   * Detect failures occurring in lifecycle methods like `@BeforeAll`
   * Instead of emitting a `<testcase>` with an empty name, map this failure to 
a synthetic or meaningful identifier (e.g., `"classInitialization"` or 
`"@BeforeAll"`)
   * Alternatively, associate the failure with all discovered test methods so 
reports remain consistent and tools consuming the XML don’t break
   
   This way, the report would always contain a valid test case name and be more 
reliable for CI and reporting tools.
   
   If this approach sounds reasonable, I’d be happy to work on implementing the 
fix.
   
   Would it be okay to assign this issue to me?
   
   Thanks!
   


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