-1

I have not used Example/Data Table to parameterized the test data, The ask is very straight forward run the same scenario multiple times sequentially.

2
  • Why would you want to do that? Your objective is unclear, therefore it is not possible to provide a good answer to your question. Jun 16 at 14:35
  • Like in testng we have this invocation count, The same thing we want to active here.
    – Niks
    Jun 21 at 7:20

2 Answers 2

1

Cucumber doesn't have re-run features, but you can simply re-execute the (bash) command to run the tests:

for i in {1..10}; do cucumber --tags @rerun; done

If you use Maven, Gradle, or something else, just replace cucumber --tags @tagname with your command.

1

In case your objective is to run your scenario multiple times over different data items, you can simply write a Scenario Outline in your gherkin feature file,

Example,

Feature: Sample Feature
  I want to run my scenario multiple times sequentially

Scenario Outline: Verify that scenario runs for all data examples.
Given I am on my application
When I perform action named <actionName>
Then I see reaction named <reactionName>

Examples:
| actionName | reactionName |
| a1         | r1           |
| a2         | r2           |
| a3         | r3           |
| a4         | r4           |

The above scenario will run 4 times (once for each example row). Scenario outline is quite helpful in order to test same scenario over different test-data, especially in the case of user interface testing.

1
  • 1
    The question is explicit in re-running the same scenario, not to vary the data. Jun 17 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.