问题
Say I have a cucumber feature file having tags @Crucial-tests, @Smoke-subset1 and @Smoke-subset2 for the scenarios.
As I understand, I can run just @Smoke-subset1 during maven execution as(say)
mvn clean install -Pcucumber-test -Dcucumber.options="--tags @Smoke-subset1"
Now I modify my runner class to have a tag which I want to run by default everytime as
@CucumberOptions(.. tags = {"@Crucial-tests"}..)
If I run the same maven command again, then the tags specified in the runner class gets overridden and only the @Smoke-subset1 executes.
Is there a way such that I can have @Crucial-tests run by default and send out extra tags through maven arguments? So that if I run the same above command it adds @Smoke-subset1 to already defined tags in runner class.
Something like -Dcucumber.options.tags.add="@Smoke-subset1". So that I could define different default tags for each of my other runner classes.
Looking for something other than
-Dcucumber.options="--tags @Crucial-tests,@Smoke-subset1"
(which applies for all runner classes)
回答1:
Found the answer here as mentioned in this video YouTube
来源:https://stackoverflow.com/questions/51439284/cucumber-java-maven-is-it-possible-to-add-a-tag-to-the-ones-defined-in-the-test