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

Use step name in backtrace and simplify the usage formatter #730

Merged
merged 3 commits into from
Sep 11, 2014

Conversation

brasmusson
Copy link
Contributor

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.

  • Take advandage of that instantiated steps have the row location and revert the usage formatter to the previous version
  • Use the expanded name in the backtrace
  • Include both the expanded step and the outline step in the backtrace
  • Update spec and features to expect the new behavior of cucumber/cucumber-ruby-core

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.
brasmusson referenced this pull request Sep 4, 2014
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.
@brasmusson brasmusson force-pushed the use-row-location-for-example-steps branch from ccd99e2 to 7a3a3fb Compare September 7, 2014 16:45
@@ -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>'
Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

Awesome!

Do you think maybe they should be the other way around? To me the outline step is deeper down the stack than the expanded step, but maybe that's just me. @tooky @os97673 WDYT?

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

I'm convinced too ;)

@brasmusson brasmusson merged commit 7a3a3fb into master Sep 11, 2014
brasmusson added a commit that referenced this pull request Sep 11, 2014
@brasmusson brasmusson deleted the use-row-location-for-example-steps branch September 11, 2014 15:55
@brasmusson
Copy link
Contributor Author

In the end the feedback was positive, so I merged this PR (which means the cucumber/cucumber-ruby-core#63 was merged first).

@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.

3 participants