How to run Cucumber with OR AND Multiple tags
21,298
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)"}
Author by
Bala
Updated on January 02, 2020Comments
-
Bala over 4 years
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"}