Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing tags as runtime argument #69

Open
jacek99 opened this issue Oct 2, 2017 · 3 comments
Open

Allow passing tags as runtime argument #69

jacek99 opened this issue Oct 2, 2017 · 3 comments

Comments

@jacek99
Copy link

jacek99 commented Oct 2, 2017

Similar to how in Ruby Cucumber you can use -t to define tags when running tests,
if would be great if this plugin allowed overriding the tags when running it, e.g.

./gradlew cucumber -Dtags=@some_feature_i_am_working_on_right_now

That would allow to use it without having to change the cucumber.tags config in build.gradle all the time

@radarsh
Copy link

radarsh commented Nov 1, 2017

You can always modify your tags configuration to look like this to support picking up runtime tags.

cucumber {
    tags = System.getProperty('tags').split(',')
}

Then you can supply one or more tags using

./gradlew cucumber -Dtags=@tag1,@tag2

@Ravinderkaur04
Copy link

@radarsh I tried your solution and the build fails saying "Cannot invoke method split() on null object" As far as I understood it is supposed to be like that. Any idea how to get through the build?

@radarsh
Copy link

radarsh commented Jun 28, 2019

@Ravinderkaur04 if you don't pass any system property called tags, that code won't work. You can use this null-safe variation to make sure it works regardless of the system property being present or not:

cucumber {
    tags = System.getProperty('tags')?.split(',')
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants