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

Add #original_location to Cucumber::Core::Ast::Step and Cucumber::Core::Test::Step #150

Merged
merged 1 commit into from
Jul 8, 2018

Conversation

brasmusson
Copy link
Contributor

Summary

Add Cucumber::Core::Ast::Step#original_location.

Details

The intention is to make the location of the OutlineStep easily accessible from the source of a Cucumber::Core::Test::Step.

Motivation and Context

A Test Step from a Scenario Outline has two locations, the location of the Outline Step and the location of the Example Table Row. This is made explicit by the Gherkin compiler in that a Pickle Step has a locations attribute, that in case of that the Pickle Step was compiled from a Scenario Outline contains both the location of the Outline Step and the Example Table Row. The Cucumber-Ruby compiler does not take this into account, the Ast::Step, Ast::ExpandedOutlineStep and Test::Step all (through include of the HasLocation module) all respond to the #location method to provide one and only one location. In case of Ast::ExpandedOutlineStep and Test::Step the location provided is the location of the Example Table Row.

Since Ast::ExpandedOutlineStep and Test::Step has two equally important locations (neither cannot be deduced from the other), they should in principle not provide a #location method. However since the use of the HasLocation module and the #location method is ubiquitous and depended on in many placed. This PR instead introduce a #original_location on Ast::Step and Ast::ExpandedOutlineStep so that both the locations of a Test Step from a Scenario Outline can be easily accessible from the source (#source.last) of the Test Step, without first having to determine whether the Test Step comes from a Scenario or a Scenario Outline.

Fixes #149.

How Has This Been Tested?

The automated test suite has been extended to verify this behavior.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

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

@stale
Copy link

stale bot commented Mar 15, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

@stale stale bot added the ⌛ stale Will soon be closed by stalebot unless there is activity label Mar 15, 2018
@brasmusson brasmusson added the 🧷 pinned Tells Stalebot not to close this issue label Mar 15, 2018
@stale stale bot removed the ⌛ stale Will soon be closed by stalebot unless there is activity label Mar 15, 2018
The intention is to make the location of the OutlineStep easily
accessible from a Cucumber::Core::Test::Step.
@brasmusson brasmusson force-pushed the ast-step-original-location branch from 1414ea4 to 1984780 Compare July 8, 2018 18:23
@brasmusson brasmusson changed the title Add Cucumber::Core::Ast::Step#original_location. Add #original_location to Cucumber::Core::Ast::Step and Cucumber::Core::Test::Step Jul 8, 2018
@brasmusson brasmusson merged commit 1984780 into master Jul 8, 2018
brasmusson added a commit that referenced this pull request Jul 8, 2018
@brasmusson brasmusson deleted the ast-step-original-location branch July 13, 2018 12:02
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Sep 23, 2018
## [3.2.0](cucumber/cucumber-ruby-core@v3.1.0...v3.2.0)

### Added

* Add the GherkinSourceParsedEvent ([#155](cucumber/cucumber-ruby-core#155) @brasmusson)
* Add #original_location to Cucumber::Core::Ast::Step and Cucumber::Core::Test::Step ([#150](cucumber/cucumber-ruby-core#150), [#149](cucumber/cucumber-ruby-core#149) @brasmusson)

### Fixed

* Set message and backtrace for undefined result also when skipping (@brasmusson)
@lock
Copy link

lock bot commented Jul 13, 2019

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 Jul 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🧷 pinned Tells Stalebot not to close this issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The location abstraction for test steps from scenario outlines is too limited
1 participant