beam022
beam022

Reputation: 1833

How to pass cucumber tags for a TestRunner run configuration in IntelliJ IDEA?

I need to pass specific @example cucumber tag with my TestRunner class execution.

I know that I can configure which tags I want to include in the run in the CucumberOptions of the TestRunner class. I'm not doing that, because I want to have several Runs configured with specific tags, so that I don't need to edit TestRunner class each time I change what is run.

This is part of my TestRunner class:

part of my TestRunner class

As you can see, I have removed the , tags = "@example" part and instead included -Dcucumber.options="--tags @example" in the VM options of the Run Configuration dialog:

Run Configuration dialog

But that doesn't work. When I run this, everything gets executed as if there was no tag information at all. What do I need to change, so that I can pass tags in the Run Configuration dialog?

Upvotes: 2

Views: 1347

Answers (1)

beam022
beam022

Reputation: 1833

Ok, I've figured it out. Instead of

-Dcucumber.options="--tags @example"

use

-Dcucumber.filter.tags=@example

in the VM options of the run.

You can leave @tags in the CucumberOptions in the TestRunner (no need to remove the line or comment it out), it will be overriden by the tags passed through VM options of the run.

Upvotes: 4

Related Questions