Lea2501
Lea2501

Reputation: 351

Excluding several different scenarios in cucumber feature file with tags

i have several cucumber scenarios with issues (tagged as @issue) on them and others that i plainly want to ignore due to several reasons (tagged as @ignore).

I made a separate jenkins job, that only runs the scenarios that have the "@issue" tag on them, but i want to exclude those from the normal executions jobs, but i also want to exclude the scenarios marked with the "@ignore" tag.

I tried the following with no success, given the following example:

  @tag1 @tag2 @severity=critical @issue @ignore
  Escenario: Scenario name
    Given The user is in some place
    When The user do something
    Then The user successfully achieved it

I run with the following command:

mvn clean test -Dcucumber.filter.tags="@tag1 and @tag2 and not @ignore or @issue"

but i got all test running, even the @ignore and @issue ones

Upvotes: 1

Views: 2851

Answers (1)

Lea2501
Lea2501

Reputation: 351

Solved! thanks to M.P.Korstanje

The correct way to use the tags for multiple exclution is this:

mvn clean test -Dcucumber.filter.tags="@tag1 and @tag2 and not (@ignore or @issue)"

Upvotes: 1

Related Questions