【问题标题】:Ruby gem CLI testing with Aruba使用 Aruba 进行 Ruby gem CLI 测试
【发布时间】:2011-12-10 06:15:26
【问题描述】:

我正在使用 Aruba 测试 gem。我的问题是,即使我在 bin 目录中没有任何内容,当我运行“可执行文件”时的步骤也会通过。 这是场景。

  Scenario: Send SMS
  When I run `serialsms`
  Then message should be sent

功能/支持/env.rb

$LOAD_PATH.push File.join(File.dirname(__FILE__), "/../../lib" )
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
require 'serial_sms'
require 'aruba/cucumber'

黄瓜产量

  Scenario: Send SMS            # features/send_sms_cli.feature:7
    When I run `serialsms`      # aruba-0.4.9/lib/aruba/cucumber.rb:56
    Then message should be sent # features/send_sms_cli.feature:9

1 scenario (1 undefined)
2 steps (1 undefined, 1 passed)
0m0.123s

You can implement step definitions for undefined steps with these snippets:

Then /^message should be sent$/ do
  pending # express the regexp above with the code you wish you had
end

这是 Aruba 的正常行为还是我做错了什么。

【问题讨论】:

    标签: ruby cucumber aruba


    【解决方案1】:

    如果您在功能定义之前添加 @announce 钩子,您可以获得一些关于 aruba 正在做什么的扩展信息。

    特别是 aruba 做了很多时髦的事情,为自己创建一个 tmp 目录,复制你的源代码等等。但这可能不是你的问题。

    IIRC

    的步骤定义
    When I run "foo"
    

    不会失败,它没有断言或匹配器。你需要像

    这样的东西来跟随它
    Then it should pass ....
    

    获得失败的测试(检查退出代码,发送到 STD(OUT|ERR) 等)

    【讨论】:

      猜你喜欢
      • 2017-01-06
      • 1970-01-01
      • 1970-01-01
      • 2015-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多