问题描述
我有2个具有不同标签(@ tag_1和@ tag_2)的功能文件.另外,我有junit测试类:
I have 2 feature files with different tags(@tag_1 and @tag_2). Also, I have junit test class:
@RunWith(Cucumber.class)
@CucumberOptions(features = path/to/features, tags = {"@tag_1", "@tag_2"})
但是,如果我运行junit test,则在控制台中会看到以下内容:
But if I run junit test, in console I see this:
但是在功能中,我会在功能词之前看到这些标签
But in features I see these tags before Feature word
怎么了?
推荐答案
如果您看一下黄瓜标签规范:
If you have a look to cucumber tags specifications:
翻译成黄瓜-jvm:
-
如果要执行 OR (运行带有@ tag1或@ tag2注释的功能)
If you want to do an OR (run features annotated with @tag1 or @tag2)
@CucumberOptions(功能=路径/功能/特征,标签= {"@ tag_1,@ tag_2"})
@CucumberOptions(features = path/to/features, tags = {"@tag_1, @tag_2"})
如果要进行 AND (运行同时带有@ tag1和@ tag2注释的功能)
If you want to do an AND (run features annotated with both @tag1 and @tag2)
@CucumberOptions(功能=路径/目标/功能,标签= {"@ tag_1","@ tag_2"})
@CucumberOptions(features = path/to/features, tags = {"@tag_1", "@tag_2"})
希望有帮助.
这篇关于如何使用Cucumber-jvm将一个功能运行到一个Junit测试中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!