Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kevinlacotaco opened this issue Nov 8, 2023 · 2 comments · May be fixed by #2349
Open

Comments

@kevinlacotaco
Copy link

🤔 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
Copy link
Contributor

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

@davidjgoss
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants