Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rubyMine 'Unable to attach test reporter to test framework'

rubyMine 'MiniTest framework was detected' error when running all model tests.

I can run all model tests at the regular command line. e.g. rake spec:models
When I use rubyMine:
I can run one model test ok.
However when I try to run all tests in model I get
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.

I tried adding the 'test-unit' to my Gemfile and rebundling but now get:

`/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`

Note: funny } in work directory. I still get the Unable to attach test_reporter to test fraemwork message.

Versions: Ubuntu 11 RubyMine 3.2

like image 766
Michael Durrant Avatar asked Sep 24 '11 13:09

Michael Durrant


3 Answers

I finally got this to work. Mostly by changing stuff under Menus:
Run -> Edit configurations -> Click on Rspec -> Create a new Configuration.

For the new configuration made sure specs folder points to the application specs models.

Final step (the one that actually that got it working) was to set the working directory (still on the run/debug configuration screen that is) to be my applications root!

The other thing I had also done was to add gem 'test-unit' to the Gemfile and bundled it of course. However later testing (removing it and unbundling) showed it not to be needed and in fact was making tests run multiple times with empty suites (maybe trying default unit::test as well as running rspec).

like image 74
Michael Durrant Avatar answered Oct 08 '22 02:10

Michael Durrant


I also had this problem but solved it differently than the other posters.

In rubymine I added the minitest-reporters gem. Then in my minitest_helper.rb I added the following:

require "minitest/reporters"
MiniTest::Unit.runner = MiniTest::SuiteRunner.new
MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMineReporter.new
like image 29
Dan Quellhorst Avatar answered Oct 08 '22 00:10

Dan Quellhorst


On my system, the problem was the "redgreen" gem. It automatically colors the progress marks (dots) and the Test::Unit summary messages based on success or failure. There must be something in RubyMine that's trying to parse the Test::Unit results (the output of "rake test", I imagine), and it's choking on the ANSI sequences.

I commented out "require 'redgreen'" in my test/test_helper.rb, and the problem went away. I really like redgreen for executing "rake test" from the shell, though, so I put this in test_helper to make it work for both "rake test" and within RubyMine:

require 'redgreen' if $stdin.tty?

It may not be redgreen that's causing your problem, but be suspicious of anything which might create unconventional Test::Unit output.

Good luck!

like image 3
Jim Stewart Avatar answered Oct 08 '22 01:10

Jim Stewart