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

Improve failure messages from output matchers #546

Merged
merged 8 commits into from
Mar 5, 2018

Conversation

mvz
Copy link
Contributor

@mvz mvz commented Mar 5, 2018

Summary

Make the message from the output matchers/steps provide enough information to figure out what went wrong.

Details

  • Make have_output matcher failure message print the command name and the full actual output.
  • Make include_an_object matcher not print boiler plate when the collection has exactly one member.
  • Remove documentation for include_an_object since it is non-public API.
  • Remove obsolete RSpec version checks

Motivation and Context

The build failures for #544 do not provide enough information to see what failed because the actual output is truncated to a single-line string.

How Has This Been Tested?

Features and specs were added.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I've added tests for my code
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

mvz added 8 commits March 4, 2018 13:53
Aruba depends on rspec-expectations >= 3.4, so these version checks will
always pass.
The include_an_object matcher is not part of Aruba's public API so
should not be described in the feature files.
This is a replacement for the feature file which was removed.
Copy link
Contributor

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

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

Having read this, it makes sense to make the change.

Extracting MessageIndenter, removing old details, and improving compatibility with RSpec Matcher usage, all incremental improvements.

When I run `cucumber`
Then the features should not all pass with:
"""
expected `aruba-test-cli` to have output string includes: "goodbye world"
Copy link
Contributor

Choose a reason for hiding this comment

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

Narrator: I was missing something.

Perhaps I am missing something, but line 61 and line 56 have mismatched wording.

  •      expected `aruba-test-cli` to have output string includes: "goodbye world"
    

"to have output string including" would be my personal expectation (just reading the line)

Then the features should all pass
Then the features should not all pass with:
"""
expected `aruba-test-cli` to have output output string is eq: "hello\nworld"
Copy link
Contributor

Choose a reason for hiding this comment

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

...but now I understand there's more to it, we're surfacing RSpec matchers more directly in these messages.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please disregard my first comment.

if RSpec::Expectations::Version::STRING >= '3.1'
RSpec::Matchers.define_negated_matcher :have_failed_running, :be_successfully_executed
end
RSpec::Matchers.define_negated_matcher :have_failed_running, :be_successfully_executed
Copy link
Contributor

Choose a reason for hiding this comment

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

Great cleanup.

@mvz mvz merged commit b7dc0d7 into master Mar 5, 2018
@mvz mvz deleted the improve-have_output-output branch March 5, 2018 10:49
@mvz
Copy link
Contributor Author

mvz commented Mar 5, 2018

Right. I still think this is an improvement, but it didn't improve the case for negative failures of include_an_object so didn't help with the original problem 😞.

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

Successfully merging this pull request may close these issues.

2 participants