I want to use Scenario Outline with multiple examples table but it runs the last examples table only, here is an example
Feature: testing scenarios with multiple examples section
Scenario Outline: outline
When a table step:
| first | second |
| <first> | <second> |
Examples: First set of examples
| first | second |
| 1 | 2 |
Examples: Second set of examples
| first | second |
| 3 | 4 |
| 5 | 6 |
this example is taken from cucumber issue https://github.com/cucumber/cucumber-js/issues/217 where it had the same issue and it was considered as a bug.
What's the benefit in separating examples into separate tables? Would the
reporting show them as groups?
On 25 September 2017 at 11:50, Mohamed Cherif Bouchelaghem <
[email protected]> wrote:
I want to use Scenario Outline with multiple example table but it runs the
last examples table only, here is an exampleFeature: testing scenarios with multiple examples section
Scenario Outline: outline
When a table step: | first | second | || | Examples: First set of examples | first | second | | 1 | 2 | Examples: Second set of examples | first | second | | 3 | 4 | | 5 | 6 |this example is taken from cucumber issue cucumber/cucumber-js#217
https://github.com/cucumber/cucumber-js/issues/217 where is had the
same issue and it was considered as a bug.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Behat/Behat/issues/1082, or mute the thread
https://github.com/notifications/unsubscribe-auth/AA6ZgHCsa5HJ8ImeBstYCde4JuINDWp2ks5sl4WIgaJpZM4Piiqj
.
--
Jon Acker
Trainer
INVIQA
Business first
T: +44 (0)203 1799 555
M: +44 (0)796 334 6071
*W: inviqa.com https://inviqa.com *
Disclaimer:This email and any attachments may be confidential and are
intended solely for the use of the addressee. Any views or opinions
expressed are those of the author and may not represent those of Inviqa. If
you are not the intended recipient of this email, you must neither take any
action based upon its contents, nor copy or show it to anyone. Please
contact the sender if you believe you have received this email in error.
I have multiple scenarios to check and they share contexts/actions the examples above dosent demonstrate the benefit, for example I design a cms so I want to check when I define a new content types which dont exist (valid scenario) and the second examples to define content types which already exists (invalid scenario), they can be in the same table (examples) but I consider this multiple scenarios in one.
Examples are Scenarios, right?
Even though "Examples" and "Scenarios" are terms that are often used in
interchangeably, Examples in Gherkin != Scenarios. Examples in Gherkin are
a data-table for a Scenario Outline.
I'm not saying that there's no case for having multiple example tables per
scenario, but in your case it sounds like you have two separate scenarios.
One in which the types exist, and one in which they don't.
On 25 September 2017 at 12:13, Mohamed Cherif Bouchelaghem <
[email protected]> wrote:
I have multiple scenarios to check and the share contexts/actions the
examples above dosent demonstrate the benefit, for example I design a cms
so I want to check when I define a new content types which dont exist
(valid scenario) and the second examples to define content types which
already exists (invalid scenario), they can be in the same table (examples)
but I consider this multiple scenarios in one.
Examples are Scenarios, right?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Behat/Behat/issues/1082#issuecomment-331850069, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AA6ZgCg18-IHg5yBOrFwCTpFcwvs_e2cks5sl4rTgaJpZM4Piiqj
.
--
Jon Acker
Trainer
INVIQA
Business first
T: +44 (0)203 1799 555
M: +44 (0)796 334 6071
*W: inviqa.com https://inviqa.com *
Disclaimer:This email and any attachments may be confidential and are
intended solely for the use of the addressee. Any views or opinions
expressed are those of the author and may not represent those of Inviqa. If
you are not the intended recipient of this email, you must neither take any
action based upon its contents, nor copy or show it to anyone. Please
contact the sender if you believe you have received this email in error.
@jon-acker After the issue submission I refactored the scenarios to be like you said, thank you :)
For readers of a scenario outline there is a case for being able to make multiple example tables. Then you can head them up with descriptions of their purpose, e.g.
Examples: of ordinary Latin character inputs
Examples: of Unicode inputs
Examples: of invalid inputs
Examples: of weird edge cases for XYZ
that makes it easier for others to understand the purpose of subsets of examples.
And if/when it becomes supported to tag scenario outline examples, you could also be able to tag each examples table.
That way, there is the potential to run different combinations of example tables on a test run. e.g. have examples tables of "a few typical valid inputs" and "a few typical invalid inputs" and tag those "smoketest". Then you can run --tag smoketest with every pull request, and have it finish in a finite amount of time. A less-frequent job can be scheduled to run everything, processing all examples tables including ones that have lists of wacky edge cases...
For the record, the current behavior is that the last examples table is run, e.g.:
Background:
Given a regular user exists
And I am logged in as a regular user
And I am on the files page
Scenario Outline: Rename a file using special characters
When I rename the file "lorem.txt" to <to_file_name>
Then the file <to_file_name> should be listed
And the files page is reloaded
Then the file <to_file_name> should be listed
Examples:
|to_file_name |
|'ordinary-name.txt' |
|'MixedCaseName.txt' |
Examples:
|to_file_name |
|'"quotes1"' |
|"'quotes2'" |
Examples:
|to_file_name |
|'लोरेम.txt' |
|'strängé name.txt' |
runs 2 scenarios for the 2 file names in the last examples table.
The other examples tables are ignored - I guess the parser sees them as free text between the Scenario Outline steps and that last Examples table.
I fixed it in fork danchukas/Behat.
I hope this fix and another features apllied to original Behat.
https://github.com/Behat/Behat/issues/1101
This might have a deep-cutting implications on formatters, so I'd look into this one for next major.
@everzet Thank you!
Any update as to when this will be part of the next behat release?
I would love to see this feature introduced so just linking the related Gherkin issue and MR here so it easier to find it.
Related Gherkin repo issue: https://github.com/Behat/Gherkin/issues/117
Related Gherkin repo PR (closed): https://github.com/Behat/Gherkin/pull/119
Most helpful comment
This might have a deep-cutting implications on formatters, so I'd look into this one for next major.