How to exclude cucumber tags
Is it possible it doesn't like the Array, maybe try:
@CucumberOptions(tags={"~@one,~@two"}, .....)
I think I figured out how it works.
@Cucumber.Options(tags = {"~@one, ~@two"})
- This translates to if '@one is not there' OR if '@two is not there' then execute the scenario
So all the scenarios in the below feature are executed. Because, the first scenario has tag @one but not @two. Similarly Second scenario has tag @two but not @one. Third Scenario has neither @one nor @two
Feature:
@one
Scenario: Tagged one
Given this is the first step
@two
Scenario: Tagged two
Given this is the first step
@three
Scenario: Tagged three
Given this is the first step
To test my understanding, I updated the feature file as below. With this change, all scenarios without tags @one or @two were executed. i.e @one @three, @two @three and @three.
Feature:
@one @two
Scenario: Tagged one
Given this is the first step
@two @one
Scenario: Tagged two and one
Given this is the first step
@one @three
Scenario: Tagged one and three
Given this is the first step
@two @three
Scenario: Tagged two and three
Given this is the first step
@one @two @three
Scenario: Tagged one two and three
Given this is the first step
@three
Scenario: Tagged three
Given this is the first step
Now if we do an AND operation:
@Cucumber.Options(tags = {"~@one", "~@two"})
- this means execute a scenario only when BOTH @one and @two are not there. Even if one of the tag is there then it will not be executed.
So as expected, only scenario with @three got executed.