Forum Discussion

sunpala's avatar
Occasional Visitor
4 years ago

Unable to override cucumber tags from command line

I have this strange issue where I am unable to override the tag in the runner with the tag I supply from command line.

Runner class:-

plugin = {"pretty",
dryRun = false,
useFileNameCompatibleName = true,
stepNotifications = true,
strict = true,
features = "src/test/resources/features",
snippets = CucumberOptions.SnippetType.CAMELCASE,
glue = {"com.Novatel"},
tags = {"@smoke"})
public class RunCucumberIT {
Sample Feature file:-


Feature: Testing the website navigation

Scenario: Navigate to the the site1
Given I click on the URL
Then I navigate to the site

Scenario: Navigate to bbc1
Given I navigate to the url
Then I am able to view the news


And I set the below sys property and run from command line:-


mvn clean verify -DCucumber.filter.tags="@sampleTest"

But it just ignores '@sampleTest' tag and runs the second scenario which has the @smoke tag which is in the runner, but that's not what I want as I need to run the features with its own tags from command line. I know it is possible, but I have no idea why it doesn't work.. I use Cucumber 5.0.0 and Junit 4.12.. Any help would be greatly appreciated. Thanks

No RepliesBe the first to reply