HJW
HJW

Reputation: 23443

How to execute a Cucumber Scenario / Feature multiple times?

I would like to know if it is possible to execute using cucumber-jvm a scenario / feature multiple times. Thanks.

Upvotes: 2

Views: 5383

Answers (1)

Viktor Chmel
Viktor Chmel

Reputation: 144

Your can use several approaches:

  1. On operation system level: run command several times or write appropriate shell script.

  2. On Cucumber level. E.g. you have following feature file:

Feature: My great feature Scenario: My scenario Given My given step one When My when step two Then My then step three

You can force cucumber-jvm run it several times e.g. 3 by transforming "Scenario" to "Scenario outlines" and using "Examples":

Feature: My great feature
  Scenario **Outline**: My scenario
   Given My given step <number>
   When My when step two
   Then My then step three
Examples: to run this scenario several times
   |number|
   |one|
   |one|
   |one|

It looks some artificially, but works. I use this approach to gather statistics for complex tests dependent of a lot of conditions.

Upvotes: 3

Related Questions