2011-09-24 38 views
13

運行所有模型測試時發現rubyMine'MiniTest框架'錯誤'。ruby​​Mine'無法附加測試記者測試框架'

我可以在常規命令行運行所有模型測試。 例如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.

我嘗試添加了「測試單元」我的Gemfile和rebundling但現在得到:

`/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的的RubyMine 3.2

回答

11

我終於得到了這個工作。 主要通過更改菜單下的東西:
運行 - >編輯配置 - >點擊Rspec - >創建一個新的配置。

對於確保規格文件夾指向應用程序規格模型的新配置。

最後一步(實際得到它工作的那一步)是將工作目錄(仍在運行/調試配置屏幕上)設置爲我的應用程序根目錄!

我還做過的其他事情是將gem 'test-unit'添加到Gemfile中,然後捆綁它。然而,後來的測試(刪除它和unbundling)表明它並不需要,實際上是使用空套件多次運行測試(可能嘗試默認unit :: test以及運行rspec)。

+1

我有一個類似的問題http://stackoverflow.com/questions/7575057/exception-message-no-such-file-to-load-in-rails-application,我的工作目錄指向應用程序的根目錄。請幫忙。謝謝! – Ava

+0

這也解決了我的問題:/usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in'require':can not加載這樣的文件 - spec_helper(LoadError) –

3

在我的系統上,問題是「紅綠」寶石。它會根據成功或失敗自動爲進度標記(點)和Test :: Unit摘要消息着色。 RubyMine中必須有一些東西試圖解析Test :: Unit結果(我想象的是「rake test」的輸出結果),並且它在ANSI序列上窒息。

我在我的test/test_helper.rb中註釋了「require'redgreen'」,問題就消失了。我真的很喜歡redgreen從外殼執行「耙測試」,雖然,所以我把這個test_helper,使之成爲既「耙測試」和RubyMine的範圍內工作:

require 'redgreen' if $stdin.tty?

它可能無法redgreen這是造成你的問題,但懷疑任何可能產生非常規Test :: Unit輸出的東西。

祝你好運!

4

我也有這個問題,但解決它不同於其他海報。

在rubymine中,我添加了minitest-reporter寶石。然後在我的minitest_helper.rb我增加了以下內容:

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

雖然我無法讓RubyMine自動包含'* _helper.rb'腳本,但必須在規範中執行才能運行。一個有用的指導也將[這一個](http://confluence.jetbrains.net/display/RUBYDEV/RubyMine+4.0+Beta+3+%28build+113.2%29+Release+Notes),一定要使用** Minitest **運行配置並設置運行目錄,如上述答案中所述 – Dr1Ku

+1

由於未定義MiniTest :: SuiteRunner,所以這對我並不適用。但是,http://www.jetbrains.com/ruby/webhelp/minitest.html說我需要使用以下版本「0.8.0及更高版本」,它的工作原理: 'require'minitest/reporter'; MINITEST :: Reporters.use!' – Anton

0

對於我來說,我通過確保文件正確命名解決了這個問題。需要從單詞測試開始或以單詞測試結束。這真的取決於測試配置下的「測試文件名掩碼」。對我來說,我的是:* /{ _test,測試_ *} RB

例:test_case_01.rbcase_01_test.rb