Simbu
Simbu

Reputation: 796

Multiple tags in Karate using and condition

I have the below variety of tags in my scenarios. These scenarios are distributed in multiple feature files.

  1. @smoke
  2. @smoke @prod
  3. @Regression
  4. @Regression @prod

I am executing karate jars via command line as below:

java -cp some-jar-with-dependecies:. -Dkarate.config.dir=. -jar  some-jar-with-dependecies.jar *.feature -T 1 -t "@smoke","@prod" -e prod

I was expecting scenarios with only @smoke @prod i.e only #2 to get executed.

But I am getting reports with #1,#2,#4 variations. It seems the tags mentioned in the command line are working as OR condition (@smoke or @ prod).

I am trying to call the scenarios with an AND condition in the tag.

Please help me on how to execute the scenarios with a tag AND condition (@smoke AND @prod).

I found some similar questions in Stack Overflow. But those solutions are not working for me: Using multiple tags to run in karate options

Upvotes: 1

Views: 2275

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58098

Did you try:

-t @smoke -t @prod

Which should be "smoke and prod"

Also:

-t @smoke -t @prod,@reg

Should be "smoke AND (prod OR reg)"

Upvotes: 1

Related Questions