-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.

João Farias
  • 10,876
  • 2
  • 18
  • 39
Niks
  • 9
  • 1
  • 3
  • Why would you want to do that? Your objective is unclear, therefore it is not possible to provide a good answer to your question. – Martin Spamer Jun 16 '22 at 14:35
  • Like in testng we have this invocation count, The same thing we want to active here. – Niks Jun 21 '22 at 07:20

2 Answers2

2

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.

João Farias
  • 10,876
  • 2
  • 18
  • 39
2

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.

Sumit Kumar
  • 444
  • 2
  • 4