I have to execute certain Examples
from Scenario Outlines
.
Let's see the following example:
Feature: Temp
Scenario Outline: Test.Something.On.<environment>
When action is performed on "<environment>"
Examples:
|environment|
|lab |
|prod |
I would like to execute only the example with lab
from the upper presented Examples
.
I tried the followings:
mvn clean test -Dcucumber.options="src/test/resources/features/Temp.feature:8"
- this way only the lab scenario was executed, however this is not a long term solution;mvn clean test -Dcucumber.options="name lab"
- it works for Scenario
but not for Scenario Outline
even if the name of the scenario will be Test.Something.On.lab
;Scenario Outline
in Scenarios
and tag the proper scenarios with @lab
and @prod
- I hate code duplication and the subsequent maintenance, therefore I hope there is an another solution for this.Any suggestions? Big thanks.
Another sub-keywords: maven
, java
, cucumber-java8
, cucumber-junit
, junit
Use two examples in yoour scenario outline and tag each example in a similar way as you have done in your third option. That should give you the behaviour you are asking for.