使用 Autotest 和 Bundler for Rails3 应用程序传递黄瓜选项
我对如何使用 cuke 的选项有点困惑。
我知道我可以在两个不同的控制台中运行spec和cucumber。但我希望它同时运行。 因此,我可以传递 rspec 的参数/选项,例如 bundle exec autotest -c -f specdoc
但如果我传递黄瓜选项,例如 --tags @wip --format Pretty
,它爆炸了。
那么,我怎样才能做到这一点?
ree-1.8.7-2010.02@automation [~/rails_apps/automation (refactor)⚡] ➔ bundle exec autotest -c --tags @wip
/Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1450:in `complete': invalid option: --tags (OptionParser::InvalidOption)
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1448:in `catch'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1448:in `complete'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1261:in `parse_in_order'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1254:in `catch'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1248:in `order!'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1339:in `permute!'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1360:in `parse!'
from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@automation/gems/autotest-4.3.2/bin/autotest:6
from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@automation/bin/autotest:19:in `load'
from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@automation/bin/autotest:19
ree-1.8.7-2010.02@automation [~/rails_apps/automation (refactor)⚡] ➔
I'm little confused on how to use cuke's options.
I know that I can run spec and cucumber in two different console. But I want it to run both.
So, I can pass args/options for rspec like bundle exec autotest -c -f specdoc
but if I pass cucumber options like --tags @wip --format pretty
, it blows out.
So, how can I accomplish this??
ree-1.8.7-2010.02@automation [~/rails_apps/automation (refactor)⚡] ➔ bundle exec autotest -c --tags @wip
/Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1450:in `complete': invalid option: --tags (OptionParser::InvalidOption)
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1448:in `catch'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1448:in `complete'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1261:in `parse_in_order'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1254:in `catch'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1248:in `order!'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1339:in `permute!'
from /Users/millisami/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/optparse.rb:1360:in `parse!'
from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@automation/gems/autotest-4.3.2/bin/autotest:6
from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@automation/bin/autotest:19:in `load'
from /Users/millisami/.rvm/gems/ree-1.8.7-2010.02@automation/bin/autotest:19
ree-1.8.7-2010.02@automation [~/rails_apps/automation (refactor)⚡] ➔
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
选项可以通过 cucumber.yml 传递给 Cucumber
例如(从链接页面) ,通过在 config/cucumber.yml 中添加以下内容:
不要忘记将环境变量
AUTOFEATURE
设置为true
之后,不带参数的自动测试应该就是您所需要的。
编辑
从自动测试集成页面:
更改使用 autotest 运行功能的方式会在 cucumber.yml 中创建两个配置文件:
例如,要在运行功能时打开颜色,您可以将以下内容添加到 cucumber.yml 文件中:
Options can be passed to Cucumber through cucumber.yml
For example (from the linked page), by having this in your config/cucumber.yml:
Don't forget to set the environment variable
AUTOFEATURE
totrue
After that, autotest with no arguments should be all you need.
EDIT
From the Autotest Integration page:
To change the way the features are run with autotest create two profiles in your cucumber.yml:
For example, to turn color on when features are run, you would add the following to your cucumber.yml file:
autotest: --format Pretty --color --tags @wip
添加到您的 config/cucumber.yml自动测试然后应该拾取标记为“wip”的所有场景。我经常使用这个,希望这会有所帮助。
autotest: --format pretty --color --tags @wip
to your config/cucumber.ymlAutotest then should pick up all scenarios tagged 'wip'. I use this quite regularly, hope this helps.