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

Updates for Issue #477 - JUnitFormatter does not put required name attribute #480

Conversation

ericmaxwell2003
Copy link
Contributor

I updated the JUnitFormatter to add attributes

  • name
  • skipped
  • time

The expected JUnit report outputs have been updated accordingly to reflect this.

Notes:
Unit tests
The name and skipped counts are being tested.

I was not able to easily test the time within the unit tests. Since the test cases are intentionally "skipped" the time is 0 anyway, so the tests pass. In lieu of a unit test, I tested this by using the new version on another project to see that indeed the times add up appropriately. To unit test, I guess I would have to mock out the cucumber.runtime.Runtime class too. If you feel strongly that this is necessary, I'll try to add it.

Testsuite Name
Finally, I use the full JUnitFormatter class name as the testsuite name value. It seemed appropriate as it indicates that the test suite is composed of cucumber junit formatted results. I also considered using the name of the class that sets up the cucumber test runner or the full Cucumber test runner class name.

… name attribute in testsuite root element.
Double.parseDouble(testCaseNodes.item(i).getAttributes().getNamedItem("time").getNodeValue());
totalDurationSecondsForAllTimes += testCaseTime;
} catch ( NumberFormatException e ) {
e.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you wrap this in a CucumberException and rethrow it instead of swallowing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@ghost ghost assigned aslakhellesoy Mar 16, 2013
@aslakhellesoy aslakhellesoy merged commit f9cad32 into cucumber:master Aug 17, 2013
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants