cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to override cucumber tags from command line

Occasional Visitor

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:-

@RunWith(Cucumber.class)
@CucumberOptions(
plugin = {"pretty",
"timeline:target/cucumber-timeline/",
"json:target/cucumber-report/cucumber.json",
"junit:target/cucumber-report/report-xml.xml"},
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:-

 

@sampleTest
Feature: Testing the website navigation

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

@smoke
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

New Here?
Join us and watch the welcome video:
Announcements
Labels