cucumber-js
cucumber-js copied to clipboard
JUnit XML Extension failure message/stack separation (custom test case element generators)
🤔 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.
To recap a bit here from a discussion on Slack:
- Exposing formatter implementation details is not desirable for a few reasons
- cucumber-js can split out the stack trace from the message (it does this already)
- If we add a separate
stackTrace
field to the message schema, we could change the junit formatter to match the desired behaviour described above
@kevinlacotaco could you show an example of an XSD-compliant JUnit output with a stack trace in a property element?