rubyMine'无法将测试报告者附加到测试框架'

时间:2011-09-24 13:10:16

标签: ruby-on-rails testing model rspec rubymine

运行所有模型测试时,

检测到rubyMine'MiniTest框架'错误。

我可以在常规命令行运行所有模型测试。 例如rake spec:models
当我使用rubyMine时:
我可以运行一个模型测试 然而,当我尝试在模型中运行所有测试时,我得到了 MiniTest framework was detected. It is a limited version of original Test::Unit framework. RubyMine/IDEA Ruby plugin test runner requires full-featured version of the framework, otherwise default console tests reporter will be used instead. Please install 'test-unit' gem and activate it on runtime.

我尝试将'test-unit'添加到我的Gemfile并重新绑定,但现在得到:

`/home/durrantm/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) 
  /home/durrantm/Downloads/RubyMine-3.2.3/rb/testing/runner/tunit_in_folder_runner.rb
Testing started at 9:33 AM ...
Work directory: /home/durrantm/Dropbox_not_syncd/webs/3/rubyists/spec/models}
Loading files.... 
=========================================
0 files were loaded.
=========================================
Searching test suites...
=========================================
0 test suites, 0 tests, 0 assertions, 0 failures, 0 errors
Process finished with exit code 0`

注意:搞笑}在工作目录中。我仍然得到Unable to attach test_reporter to test fraemwork message

版本: Ubuntu 11 RubyMine 3.2

4 个答案:

答案 0 :(得分:11)

我终于开始工作了。 主要是通过更改菜单下的内容:
 运行 - >修改配置 - >点击Rspec - >创建一个新配置。

对于新配置,确保specs文件夹指向应用程序规格模型。

最后一步(实际上让它工作的那一步)是设置工作目录(仍然在运行/调试配置屏幕上)作为我的应用程序root!

我还做的另一件事是将gem 'test-unit'添加到Gemfile并捆绑它当然。然而,后来的测试(删除它和分拆)显示它不需要,实际上是使用空套件进行多次测试(可能尝试使用默认单位:: test以及运行rspec)。

答案 1 :(得分:4)

我也有这个问题,但解决方法与其他海报不同。

在rubymine中,我添加了minitest-reporter gem。然后在我的minitest_helper.rb中添加了以下内容:

require "minitest/reporters"
MiniTest::Unit.runner = MiniTest::SuiteRunner.new
MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMineReporter.new

答案 2 :(得分:3)

在我的系统上,问题是“redgreen”宝石。它会根据成功或失败自动为进度标记(点)和Test :: Unit摘要消息着色。在RubyMine中必须有一些东西试图解析Test :: Unit结果(我想象的“rake test”的输出),并且它在ANSI序列上窒息。

我在test / test_helper.rb中注释掉了“require'redgreen'”,问题就消失了。我真的很喜欢redgreen从shell执行“rake test”,所以我把它放在test_helper中,使它适用于“rake test”和RubyMine:

require 'redgreen' if $stdin.tty?

可能不是红绿色导致你的问题,但要怀疑任何可能产生非常规Test :: Unit输出的东西。

祝你好运!

答案 3 :(得分:0)

对我来说,我通过确保正确命名文件来解决此问题。需要从单词test开始或以单词test结束。这实际上取决于测试配置下的“测试文件名掩码”。对我来说,我的是:* / { _test,test _ *}。rb

例如: test_case_01.rb case_01_test.rb