自动测试:“无法运行测试”。但是日志中没有任何内容

时间:2010-12-06 16:49:37

标签: ruby-on-rails rspec rspec2 autotest zentest

自动测试因rspec-rails 2.2.1更新而中断。现在我无法让它再次运作..甚至在回滚到rspec-rais 2.2.0之后。

只有我能找到的信息是一个Growl弹出窗口,上面写着“ App:无法运行测试”。没有任何内容写入log/test.log

这是在控制台输出:

/Users/meltemi/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -I.:lib:test -rubygems -e "%w[test/unit test/test_helper.rb].each { |f| require f }" | unit_diff -u
Loaded suite -e
Started

Finished in 0.003428 seconds.


0 tests, 0 assertions, 0 failures, 0 errors, 0 skips

Test run options: --seed 38767

任何想法从哪里开始排除故障?我会看一个autotest.log ......如果我能找到一个!?!

修改尝试使用autotest -v运行自动测试,并在控制台中获取一个“没有匹配的测试...... ”的清单(20以下示例) ):

...
No tests matched .git/objects/fe/41f5cc24d667635c46a533fd09bf7bb514e032
No tests matched .git/objects/fe/4577696b2811818fe7439990be0d2f65a892c5
No tests matched .git/objects/fe/e16b09c5e782035a347ed9b257ff9b2b3fa173
No tests matched .git/refs/heads/MenuModel
No tests matched .git/refs/heads/master
No tests matched .git/refs/remotes/origin/master
No tests matched .git/refs/tags/v0.0.1
No tests matched .git/refs/tags/v0.0.1.1
No tests matched .gitignore
No tests matched .rspec
No tests matched Capfile
No tests matched Gemfile
No tests matched Gemfile.lock
No tests matched README
No tests matched Rakefile
No tests matched app/helpers/application_helper.rb
No tests matched autotest/discover.rb
No tests matched config/application.rb
No tests matched config/boot.rb
No tests matched config/database.yml
No tests matched config/deploy.rb
No tests matched config/environment.rb
...

这是配置(~/.autotest):

# ~/.autotest
# Include plugins
require 'autotest/fsevent'
require 'autotest/growl'

# ./.autotest
# exceptions (files to ignore) 
# mappings (which files to specifically monitor for changes)
Autotest.add_hook(:initialize) {|at|
  at.add_exception %r{^\.git}  # ignore Version Control System
  at.add_exception %r{^./tmp}  # ignore temp files, lest autotest will run again, and again...
  #  at.clear_mappings         # take out the default (test/test*rb)
  at.add_mapping(%r{^lib/.*\.rb$}) {|f, _|
    Dir['spec/**/*.rb']
  }
  nil
}

1 个答案:

答案 0 :(得分:4)

autotest -s rspec2告诉自动测试使用“rspec2”样式,这将使其查找spec文件并在其中运行示例。

这只是一种解决方法。自动测试应该根据项目./autotest/discover.rb中的条目发现规范。正如您所发现的,最近的代码更新打破了自动发现。我自己遇到了这个问题,无法追查来源。