问题描述
说我有一个黄瓜特征文件,其中包含标签 @ 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"
现在,我将跑步者类修改为要默认运行的标签,
Now I modify my runner class to have a tag which I want to run by default everytime as
@CucumberOptions(.. tags = {"@Crucial-tests"}..)
如果再次运行相同的maven命令,则将覆盖运行器类中指定的标签,并且仅执行 @ 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"
(适用于所有亚军课程)
(which applies for all runner classes)
推荐答案
找到了答案此视频
这篇关于Cucumber-java-maven:是否可以在测试类中定义的标签上添加标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!