user1539343
user1539343

Reputation: 1669

cucumber command line options don't override @CucumberOptions

I have this cucumber runner class:

@RunWith(Cucumber.class) 
@CucumberOptions(plugin = {"pretty", "html:target/cucumber"},
features="classpath:features",
tags= {"@concrete"}) 
public class RunCuke {

}

This is the code available in git repository. While developing my own features, I want to use the same class but want to pass my own tags for it to run. But I don't want to modify this class (passing my own tag, say, @outline instead of @concrete), because this is a nuisance while committing code because each time I want to commit, I have to revert this file back to what is in the code repo (ie back to @concrete). Only way I think of is to pass the command line argument to this class.

So I am using this command line argument (program argument in the eclipse IDE):

-Dcucumber.options=”–tags @outline”

Unfortunately it is not working. It is not overriding what is there in @CucumberOptions.

How do I make it work?

Upvotes: 1

Views: 1654

Answers (1)

Grasshopper
Grasshopper

Reputation: 9058

You need to select 'Run Configurations' and go to the specific runner config. Go to the 'Environment' tab. Add a new variable 'cucumber.options' and set it to '--tag @outline'. You might need to switch the 'Append environment to native environment' and 'Replace native environment with specified environment', though I have found the default of 'append' works perfectly. Apply and Run.

enter image description here

Upvotes: 2

Related Questions