Is there any equivalent "for each" statement for Gherkin? In the following scenario, the page I am testing has multiple date fields that I'd like to run the same test examples on.
Here is the scenario that I would like to model.
Scenario Outline: Modify precision values for date controls
Given I have just added a record
When I select <precision>
And I select <value>
Then <date> displays in the <date type> field
Examples:
| date type | precision | value | date |
| Date 1 | Unknown | N/A | "Unknown" |
| Date 1 | Year | <current year> | <current year> |
| Date 1 | Month | <current month> | <current month, year> |
| Date 1 | Day | <current day> | <current month/day/year> |
| Date 2 | Unknown | N/A | "Unknown" |
| Date 2 | Year | <current year> | <current year> |
| Date 2 | Month | <current month> | <current month, year> |
| Date 2 | Day | <current day> | <current month/day/year> |
Suppose there are 5 date type fields on the same page. It seems unnecessary to have to copy/psate 12 more rows in the table to cover Date 3 - Date 5. That's why I was wondering if there is a "for each" equivalent so that I can perform the same examples for each date type without having to explicitly show that in the Examples table. Or perhaps there is a different way I could structure the scenario?
Thanks for any assistance you can provide!
Cucumber is not designed to support multi-column iterations, but it is possible to make it work. Here, I want to try each combination of path and role:
Nope, cucumber is not designed with looping in mind. Cucumber's scope is to allow defining application expectancies from a user perspective. And since real users don't "loop", it doesn't make sense to have it implemented in cucumber.
What can be done, programatically speaking, is to write a program that generates the same cucumber scripts for every combination in your application.