Cucumber-java-maven: Is it possible to add a tag to the ones defined in the test class?

前提是你 提交于 2020-07-20 06:05:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!