-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: add junit formatter #2121
feat: add junit formatter #2121
Conversation
Thanks for raising this @ricalbuquerque, we do indeed need a JUnit formatter and this looks like a good implementation at first glance. There's a broader effort in cucumber/common#871 to have a JUnit formatter for all Cucumber implementations that behave the same (share a test suite etc), so I'm going to bring this up there and see if it could be a vehicle to get that piece moving a bit in the right direction, and I'll probably come back with some detailed review comments soon. |
Thank you @davidjgoss. I don't mean to interfere with any plans for a new formatter. I did try a few formatters (some of them seem to be a bit old) and none would do what I was expecting to (treating scenarios as testcases) so this was my motivation. |
@ricalbuquerque not an interference at all, I think this could help move it forward. I don't think there will be a single implementation in Go, that model didn't work great in practise for other components. More like, a shared set of tests and then native implementations in JavaScript, Java, Ruby etc that all pass those same tests. So this is definitely in line with that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the test cases, I feel there may be a lot of fidelity missing. I can't provide concrete examples right now but contrast with the Cucumber JVM test cases:
And so it might be good to compare against the XSD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following on from previous comments, just calling out things that are different from the style seen in cucumber-jvm which I think we should align with:
- All steps from the scenario with their statuses are printed with a consistent line width in the
<system-out>
tag, see https://github.com/cucumber/cucumber-jvm/blob/ee6b693184b463c023a265fe98fa9ab5ab2ce819/cucumber-core/src/test/java/io/cucumber/core/plugin/JUnitFormatterTest.java#L69 - There is a single
<testsuite>
(not one for each feature), and each<testcase>
uses the feature name asclassname
and scenario name asname
respectively - Failures have the
type
andmessage
as attrs on the<failure>
tag and the stack in the body of that tag - I don't think we can do this with cucumber-js because the message and stack are not separated, so we'll have to omitmessage
attr
I'm happy to jump in and help out with any of this if you'd like, just let me know. Thanks again for putting this together.
We need this as CircleCI will stop support for JSON format in 20 days. Here is the announcement: https://discuss.circleci.com/t/cucumber-test-results-format-deprecation/45776
This PR is the only way to continue using cucumber with CircleCI. The existing JUnit formatted plugin is not working with new cucumber-js versions: |
@ricalbuquerque are you happy for me to make some of the changes discussed above so we can get this in? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Spotted a few complicated problems.
@mpkorstanje I've made some updates to bring this pretty much in line with what the cucumber-jvm one does, and added more tests. Would you mind taking another look before I merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge thanks @ricalbuquerque for contributing this!
Hi @ricalbuquerque, Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾 In return for this generous offer we hope you will:
On behalf of the Cucumber core team, |
Looks good! |
🤔 What's changed?
⚡️ What's your motivation?
Needed to get proper reporting in Azure Pipelines so had to develop a JUnit formatter that would not treat each step as a different test. After testing and started to use it I decided to make it available for the community,
🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
📋 Checklist:
This text was originally generated from a template, then edited by hand. You can modify the template here.