使用 Autotest 和 Bundler for Rails3 应用程序传递黄瓜选项

发布于 2024-09-10 01:45:34 字数 1699 浏览 2 评论 0原文

我对如何使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

彩扇题诗 2024-09-17 01:45:34

选项可以通过 cucumber.yml 传递给 Cucumber

例如(从链接页面) ,通过在 config/cucumber.yml 中添加以下内容:

default: --format profile features
html_report: --format progress --format html --out=features_report.html features  

不要忘记将环境变量 AUTOFEATURE 设置为 true

之后,不带参数的自动测试应该就是您所需要的。

编辑

自动测试集成页面:

更改使用 autotest 运行功能的方式会在 cucumber.yml 中创建两个配置文件:

  • autotest :当 Autotest 希望仅运行失败场景时使用。
  • autotest-all :当自动测试想要运行所有场景时使用(在红色→绿色转换之后)。

例如,要在运行功能时打开颜色,您可以将以下内容添加到 cucumber.yml 文件中:

autotest: --color
autotest-all: --color

Options can be passed to Cucumber through cucumber.yml

For example (from the linked page), by having this in your config/cucumber.yml:

default: --format profile features
html_report: --format progress --format html --out=features_report.html features  

Don't forget to set the environment variable AUTOFEATURE to true

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:

  • autotest : Used when Autotest wants to run only the failing scenarios.
  • autotest-all : Used when Autotest wants to run all the scenarios (after a red→green transition).

For example, to turn color on when features are run, you would add the following to your cucumber.yml file:

autotest: --color
autotest-all: --color
隐诗 2024-09-17 01:45:34
  1. autotest: --format Pretty --color --tags @wip 添加到您的 config/cucumber.yml
  2. 重新启动自动测试

自动测试然后应该拾取标记为“wip”的所有场景。我经常使用这个,希望这会有所帮助。

  1. Add autotest: --format pretty --color --tags @wip to your config/cucumber.yml
  2. Restart autotest

Autotest then should pick up all scenarios tagged 'wip'. I use this quite regularly, hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文