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

Rewrite the JUnit Formatter to the new formatter Api #855

Merged
merged 4 commits into from Jun 19, 2015

Conversation

brasmusson
Copy link
Contributor

The rewrite does also automatically fixed some problems regarding Scenario Outline test cases. Multiple failing test cases from the same Examples table, and pending and undefined test cases from Scenario Outlines in strict mode, have not been handled properly.

In addition the intercepted stdout and stderr data are moved from the testsuite elements (which representing Features) to the testcase element (fd5e38e). Stdout and stderr elements are already created (but empty) for testcase elements. It makes more sense to put the intercepted stdout and stderr in the testcase, and having empty stdout and stderr elements there (which stated "nothing was intercepted") seems to misinformation is anything.

The final change (4f3ebda) requires cucumber/cucumber-ruby-core#92, I think a Result#non_zero_exit_status? query can simplify logic not only in the JUnit Formatter, but also in other parts of the Cucumber code base.

Related to #839.

The current implementation of the JUnit Formatter does not handle
several failing scenarios form the same Examples table correctly.
Nor does it handle undefined or pending scenarios properly in strict
mode.
@builder = Builder::XmlMarkup.new( :indent => 2 )
@time = 0
def before_test_case(test_case)
if not same_feature_as_previous_test_case?(test_case.feature)
Copy link
Contributor

Choose a reason for hiding this comment

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

Link to style-guide on not vs !: https://github.com/bbatsov/ruby-style-guide#bang-not-not

Another thing: How to use Ruby's English and/or operators without going nuts It would be great if you could examine all of the other new usages of and and or, to see whether they should not rather be the conventional && and ||.

(By the way: SUPER awesome that you update the JUnit formatter!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shouldn't unless be as good as if !?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, you're right, in this case there is no else, and we are free to improve one step more.

(By preferring unless over if ! and by not using not you now fixed two things.)

Copy link
Contributor

Choose a reason for hiding this comment

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

In order to learn more about code conventions, you can use Rubocop on the files you've changed, and get a detailed report on any code-style deviations. The repo as a whole does not follow the above-mentioned style guide, but lots of Ruby idiom can be gleaned from reading the tool's output. (How much does Cucumber code-base not follow rubocop in all files?: "327 files inspected, 6849 offenses detected")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reworked the commit and fixed all conditionals related Rubocop detected issues. I did not fix everything Rubocop remarked on. I usually think "evolution, not revolution", and when the code base generally doesn't seem to follow the "no lines longer than 80 characters", I do not go over the top to only write lines shorter than 80 characters either (for example).

Since Cucumber is Scenario/Test Case oriented it makes more sense to
put the intercepted stdout and stderr there, instead in the testsuite
element (that represents the Feature). Stdout and stderr elements are
already created for the testcase elements, but they have so far always
been empty.
@brasmusson brasmusson force-pushed the junit-formatter-new-api branch 3 times, most recently from 2d55075 to 085c58f Compare May 31, 2015 14:41
mattwynne added a commit that referenced this pull request Jun 19, 2015
Rewrite the JUnit Formatter to the new formatter Api
@mattwynne mattwynne merged commit 192a744 into master Jun 19, 2015
@brasmusson brasmusson deleted the junit-formatter-new-api branch June 20, 2015 06:23
@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.

None yet

3 participants