cucumber / cucumber-js

Cucumber for JavaScript
https://cucumber.io
MIT License
5.02k stars 1.09k forks source link

JUnit XML Extension failure message/stack separation (custom test case element generators) #2348

Open kevinlacotaco opened 9 months ago

kevinlacotaco commented 9 months ago

πŸ€” What's the problem you're trying to solve?

I am getting a clear dashboard constructed in DataDog from junit uploads from cucumber runs.

✨ What's your proposed solution?

I would like to separate the stack trace from the message within the failure element. DataDog allows providing metadata through property elements. As is DataDog currently attaches the child element of failure (cdata error stack) to the message. It would be nice to have some transform function or extensibility to the base formatter. If there were small template methods that can be extended to build a 'failed test case' element (among the others) it could help to keep most of the buildXmlReport function constant.

⛏ Have you considered any alternatives or workarounds?

I have currently been experimenting with yarn patch and creating a local junit formatter that extends the base (had to patch the private function call). A lot of this is to experiment to see how DataDog would like to tag the errors with the stack.

Another approach that was suggested was an XSLT which might be able to take the child element of failure and move it to a sibling property element.

πŸ“š Any additional context?


This text was originally generated from a template, then edited by hand. You can modify the template here.

davidjgoss commented 8 months ago

To recap a bit here from a discussion on Slack:

davidjgoss commented 6 months ago

@kevinlacotaco could you show an example of an XSD-compliant JUnit output with a stack trace in a property element?