Allow Scenario reuse
See original GitHub issueI would like to reuse step definitions grouped to a scenario. This is particularly useful, if TDD strategy is used for incremental tests development along a happy path. In doing so, the scenarios follow the pattern below:
Feature HappyPath
Scenario X
Given A
When B
Then C
Scenaro X+1
Given A
And B
When C
Then D
Scenaro X+2
Given A
And B
And C
When D
Then E
and so on. I would like to reuse the information already stated in the previous scenario. In order to do so, we can rewrite the previous feature HappyPath in the following way:
Feature HappyPath
Scenario X
Given A
When B
Then C
Scenario X+1
Given "Scenario X"
When "Scenario X"
And C
Then D
Scenario X+2
Given "Scenario X+1"
When "Scenario X+1"
And D
Then E
The meaning of Given “Scenario X” is to execute all steps from Scenario X annotated with Given, When “Scenario X” will execute all When steps from the Scenario X and Then “Scenario X” is responsible for running all Then steps from the scenario.
This addition will allow getting a much higher reuse of Gherkin definitions and steps from the glue classes. In particular, fosters the reuse of parameters used in steps and reduces duplication.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top GitHub Comments
This is relevant: http://blog.josephwilk.net/ruby/cucumber-waves-goodbye-to-givenscenario.html
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.