Is there a “for each” or equivalent syntax for Gherkin/Cucumber?

Questions
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
Examples:
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! |
————————————————-
Answer
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. |
cucumber,gherkin |
Facebook Comments