How should I pass 2 test groups to karate: 1 ignore group and 1 include group

Viewed 152

Here is my scenario.

I setup a Karate Java runner test method like this:

Results results = Runner.path("classpath:features")
    .outputCucumberJson(true)
    .tags(GLOBAL_INCLUDE, GLOBAL_IGNORE_ALL)
    .parallel(5);

And I setup variables for test groups like so:

static final String REGRESSION_TAG = "regression";
static final String GLOBAL_IGNORE_ALL = "~@ignore";
static final String GLOBAL_INCLUDE = "@" + System.getProperty("test.type", REGRESSION_TAG).toLowerCase();

But the above configuration FAILS to ignore the @ignore tags.

The only way I could get it to work was by adding the deprecated test runner annotation like so:

@KarateOptions(tags = {"~@ignore"} )
public class RunIT {
...
Results results = Runner.path("classpath:features")
    .outputCucumberJson(true)
    .tags(GLOBAL_INCLUDE)
    .parallel(5);
...

Anyone have any idea what I am doing wrong? Just trying to pass 2 tags in a AND-condition style: all the regression tests minus the ignore tests.

Version: Karate 1.0.1

1 Answers
Related