In short, I need to create a script diagram with a step that can be repeated without entering it using several And, as I am doing now:
Scenario Outline: outline Given I am a user When I enter <x> as an amount And I enter <x2> as an amount Then the result should be <result> Scenarios: |x|x2|result| |1|2 |3 | |1|0 |1 |
However, I would like to do something like the following:
Scenario Outline: outline Given I am a user When I enter <Repeat: x> as an amount Then the result should be <result> Scenarios: |x |result| |1,2,3|6 | |1,2 |3 |
Basically, I want “I entered as quantity” to run 3 and 2 times, respectively.
The closest I found to this question is How to re-run the outline of a cucumber script with different parameters? but I wanted to double check before giving up and using StepArgumentTransformation with a comma separated list or something similar.
The last answer I went with is something more:
Scenario Outline: outline Given I am a user When I enter the following amounts | Amount1 | Amount 2| Amount3| | <Amt1> | <Amt2> | <Amt3> | Then the result should be <result> Scenarios: |Amt1 |Amt2 |Amt3 |result| |1 |2 |3 |6 |
There seems to be no good way to leave the value blank, but this is pretty close to the solution I was looking for
source share