How to run more then one feature into one junit test with cucumber-jvm

随声附和 提交于 2019-12-11 11:56:49

问题


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"})

But if I run junit test, in console I see this:

0 scenarios
0 steps
None of the features at [path/to/features] matched the filters: [@tag_1, @tag_2]

But in features I see these tags before Feature word

What's wrong?


回答1:


If you have a look to cucumber tags specifications:

  • Tags which are comma separated are ORed
  • Tags which are passed in separate —tags are ANDed

Translated to cucumber-jvm:

  • If you want to do an OR (run features annotated with @tag1 or @tag2)

    @CucumberOptions(features = path/to/features, tags = {"@tag_1, @tag_2"})

  • If you want to do an AND (run features annotated with both @tag1 and @tag2)

    @CucumberOptions(features = path/to/features, tags = {"@tag_1", "@tag_2"})

Hope it helps.



来源:https://stackoverflow.com/questions/32269206/how-to-run-more-then-one-feature-into-one-junit-test-with-cucumber-jvm

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