Cucumber-java-maven:是否可以为测试类中定义的标签添加标签? [英] Cucumber-java-maven: Is it possible to add a tag to the ones defined in the test class?
问题描述
假设我有一个黄瓜功能文件,其中包含用于场景的标签 @Crucial-tests
、@Smoke-subset1
和 @Smoke-subset2
.据我了解,我可以在 maven 执行期间只运行 @Smoke-subset1
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"
现在我修改我的 runner 类,使其具有一个我想在每次默认情况下运行的标签
Now I modify my runner class to have a tag which I want to run by default everytime as
@CucumberOptions(.. tags = {"@Crucial-tests"}..)
如果我再次运行相同的 maven 命令,则 runner 类中指定的标签会被覆盖,并且只有 @Smoke-subset1
会执行.
If I run the same maven command again, then the tags specified in the runner class gets overridden and only the @Smoke-subset1
executes.
有没有一种方法可以让 @Crucial-tests
默认运行并通过 maven 参数发送额外的标签?因此,如果我运行相同的上述命令,它会将 @Smoke-subset1
添加到运行器类中已定义的标签中.
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.
类似 -Dcucumber.options.tags.add="@Smoke-subset1"
.这样我就可以为每个其他跑步者类定义不同的默认标签.
Something like -Dcucumber.options.tags.add="@Smoke-subset1"
. So that I could define different default tags for each of my other runner classes.
寻找其他的东西
-Dcucumber.options="--tags @Crucial-tests,@Smoke-subset1"
(适用于所有跑步者)
推荐答案
Found the answer here as mentioned in this video YouTube
这篇关于Cucumber-java-maven:是否可以为测试类中定义的标签添加标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!