How to make cucumber run all feature if no matching tag
Im using cucumber with fork. I really like the run_all_when_everything_filtered on Rspec. that开发者_如何学运维 runs all the spec if there is no matching tag. Can I do this with cucumber. example in my auto test profile, i specify --tags @wip, but if there is no matching tags it run all of the scenario
I'm pretty sure that Cucumber doesn't support this natively. If you're using Guard to run these, you could probably get the behaviour you're after by calling out to a script or custom rake task instead of invoking Cucumber directly.
It should be fairly trivial to write a script or rake task to invoke Cucumber with the -t @wip
argument, then check to see if the output contains '0 scenarios', and if so then run Cucumber again without a -t
argument, to execute the whole suite.
If you know the name of the tag, you can specify the tag with an "~" before the tag. That is --tags ~@wip
.
What this means, is the tag you specify to cucumber, can be a boolean expression.
- The "~" option before the tag, represents a
NOT
. - You can specify an
OR
, if you write--tags @wip1,@wip2
. - You can specify an
AND
, by writing the --tags options several times.
I encourage you to run cucumber -h
and checkout the option --tags, to see more information.
精彩评论