你如何让黄瓜/警卫过滤像@wip的标签? [英] How do you get cucumber/guard to filter on tags like @wip?

查看:187
本文介绍了你如何让黄瓜/警卫过滤像@wip的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行spork和guard,所有的一切都进行得很好,我的RSpec测试,都运行正常。为了加快测试速度,我可以成功地过滤我的RSpec测试,我放在我的 .rspec 文件中。

I'm running spork and guard and all has been going very well with my RSpec tests which were all run correctly. In order to speed up the tests I could successfully filter my RSpec tests with tags I placed in my .rspec file.

.rspec

--colour
--debug
--tag focus
--tag now

不幸的是,我无法过滤黄瓜标签。每次黄瓜运行它运行一切或只是改变的文件。

Unfortunately though I have not been able to filter my cucumber tags. Every time cucumber runs it runs either everything or just the file that changed.

如何获取黄瓜/猪肉/猪圈以尊重像@wip,@now等标签,只运行那些测试?是否有一些等同于 .rspec 的黄瓜标签文件?

How can I get cucumber/spork/guard to respect tags like @wip, @now etc and run only those tests? Is there some equivalent to the .rspec file for cucumber tags?

推荐答案

您可以使用黄瓜配置文件定义要执行的标签。使用YML文件,您可以定义执行@wip标签的配置文件:

You could use a cucumber profile to define the tags that you want to execute. Using the YML file, you can define a profile that execute your @wip tags:

wip: --tags @wip

更多信息:

https://github.com/cucumber/cucumber/wiki/cucumber.yml

您也可以从命令行运行cucumber,并传递-t参数:

You can also just run cucumber from the command line and pass it the -t argument:

cucumber -t @wip,@now



从帮助(黄瓜-h):

From the help (cucumber -h):


只能使用与
TAG_EXPRESSION匹配的标签执行功能或场景。
Scenarios继承在Feature级别上声明的标记。最简单的
TAG_EXPRESSION只是一个标签。示例:--tags @dev。当标签
中的标签以〜开头时,表示布尔值为NOT。示例:--tags〜@ dev。
标签表达式可以有多个标签,用逗号分隔,表示
逻辑或。示例:--tags @ dev,@ wip。 --tags选项可以指定
多次,这表示逻辑AND。示例:--tags @ foo,〜@ bar --tags @zap。
这表示布尔表达式(@foo ||!@bar)&& @zap

Only execute the features or scenarios with tags matching TAG_EXPRESSION. Scenarios inherit tags declared on the Feature level. The simplest TAG_EXPRESSION is simply a tag. Example: --tags @dev. When a tag in a tag expression starts with a ~, this represents boolean NOT. Example: --tags ~@dev. A tag expression can have several tags separated by a comma, which represents logical OR. Example: --tags @dev,@wip. The --tags option can be specified several times, and this represents logical AND. Example: --tags @foo,~@bar --tags @zap. This represents the boolean expression (@foo || !@bar) && @zap

因此,理论上我们可以使用guardfile这些选项:

Hence, in theory we can use the guardfile with these options:

guard 'cucumber', :cli => "--drb --tags @now" do
  watch(%r{^features/.+\.feature$})
  ...
end

这篇关于你如何让黄瓜/警卫过滤像@wip的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆