Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Cucumber with OR AND Multiple tags

I have cucumber scenarios with examples. Examples are split into using multiple tags like below:

Feature: ...
  Scenario Outline: ...
    ...    
    @Admin @INT
      Examples:
      ...    
    @Admin @EXT
      Examples:
      ...
    @User @EXT
      Examples:
      ...
    @User @INT
      Examples:
      ...

To run scenarios with tags @Admin AND @EXT I use

...tags = {"@Admin","@EXT"}...

How do I run scenarios with

{"@Admin","@EXT"} && {"@User","@INT"}, {"@Admin","@EXT"} || {"@User","@INT"}

like image 288
Bala Avatar asked May 28 '14 15:05

Bala


1 Answers

This change was introduced into cucumber-jvm 2.0.0 (2017-08-29)

Support Tag Expressions (part of #1035 Björn Rasmusson)

Migrating from old style tags
--tags @dev stays the same
--tags ~@dev becomes --tags 'not @dev'
--tags @foo,@bar becomes --tags '@foo or @bar'
--tags @foo --tags @bar becomes --tags '@foo and bar'
--tags ~@foo --tags @bar,@zap becomes --tags 'not @foo and (@bar or @zap)'

So perhaps something like this:

-Dcucumber.options="--tags '(@Admin and @EXT) or (@User and @INT)'"

EDIT

For @CucumberOptions, the above would look like:

tags = {"@tag"} is unchanged

tags = {"~tag"} becomes tags = {"not tag"}

tags = {"@tag1,@tag2") becomes tags = {"@tag1 or @tag2"}

tags = {"@tag1","@tag2"} becomes tags = {"@tag1 and @tag2"}

tags = {"@tag1","@tag2,@tag3"} becomes tags = {"@tag1 and (@tag2 or @tag3)"}

like image 182
MikeJRamsey56 Avatar answered Dec 18 '22 03:12

MikeJRamsey56