-
-
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
Use step name in backtrace and simplify the usage formatter #730
Conversation
When cucumber-ruby-core use the row location for instantiated outline steps, the usage formatter can be simplified. Use the (expanded) step name in the backtrace to be consistent with the step location for instantiated outline steps.
Add a scenario to the usage formatter feature for the --expand case, and update the usage formatter to pass this scenario.
That is that the location a expanded outline step is the row location, and that both the expanded step and the outline step is included in the backtrace. Update the gherkin_formatter_adapter to use the row location for expanded steps.
ccd99e2
to
7a3a3fb
Compare
@@ -121,6 +121,7 @@ Feature: Pretty formatter - Printing messages | |||
| 1 | anno1 | fail | Line: 1: anno1 | |||
(RuntimeError) | |||
./features/step_definitions/puts_steps.rb:13:in `/^I use message (.+) in line (.+) (?:with result (.+))$/' | |||
features/f.feature:29:in `Given I use message anno1 in line 1 with result fail' | |||
features/f.feature:25:in `Given I use message <ann> in line <line> with result <result>' |
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.
@mattwynne Now both the outline step and the expanded step is included in the backtrace, WDYT?
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.
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.
I'd also except to see outline step deeper than the expanded one.
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.
The reason I put the expanded step deeper is from considering a case like this (which exist in our features for Cucumber):
Scenario Outline:
Given this step <state>
Examples:
| state |
| passes |
| fails |
with step definitions like:
Given(/^this step passes$/) { }
Given(/^this step fails$/) { fail }
Depending on the example row, the expanded step will be matched to different step definitions, which make the expanded steps closer related to the step definitions than the outline step (for which there is no matching step definition).
In case of like this:
Scenario Outline:
Given I have "<count>" cukes in by belly
Then the expanded steps will be matched to the same step definition, only the argument passed to the step definition will differ, so putting the outline step deeper could make sense here.
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.
I see what you mean @brasmusson, and I think you've convinced me.
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.
I'm convinced too ;)
In the end the feedback was positive, so I merged this PR (which means the cucumber/cucumber-ruby-core#63 was merged first). |
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. |
When cucumber-ruby-core use the row location for instantiated outline steps, the usage formatter can be simplified. Use the (expanded) step name in the backtrace to be consistent with the step location for instantiated outline steps.
Requires cucumber/cucumber-ruby-core#63.