问题
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