'Unable to override cucumber tags in Cucumber options 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:-
mvn clean verify -DCucumber.filter.tags="@sampleTest"
But it just ignores the above tag to run the feature and runs the second scenario with @smoke tag, 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 have googled for hours with no luck. I use Cucumber 5.0.0 and Junit 4.12.
Any help would be greatly appreciated. Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|