Is it possible for multiple scenarios to use the same Examples table?
So instead of having something like the following:
Scenario Outline: First Scenario
Given I am viewing "<url>"
Then I assert that the current URL "<url>"
Examples:
| url |
| https://google.com |
| https://twitter.com|
Scenario Outline: Second Scenario
Given I am viewing "<url>" with route "</contactus>"
Then I assert that "<url>" contains "contactus"
Examples:
| url |
| https://google.com |
| https://twitter.com|
I can do something like
Scenario Outline: Reusable Example
Examples:
| url |
| https://google.com |
| https://twitter.com|
Scenario: First Scenario
Given I am viewing "<url>"
Then I assert that the current URL "<url>"
Scenario: Second Scenario
Given I am viewing "<url>" with route "</contactus>"
Then I assert that "<url>" contains "contactus"
I found a similar question on StackOverflow, but merging all my scenarios in just one scenario is not an option for me. Since this question was posted in 2014, maybe there have been some advancements in the framework which I am not aware of :D
Thank you in advance.
You can use qaf-gherkin where you can move examples in external file and use it with one or more scenario. With qaf your feature file may look like below:
And your datafile will look like:
Here is the reference.
You might use a Background to specify steps which are equal for all scenarios. (Have a look on the link for constraints)
A feature file might look like
implementing the glue code for the
Given
edit After the question has been updated a
Scenario Outline
could work for both examples.