rubyMine 'Unable to attach test reporter to test framework'

懵懂的女人 提交于 2019-12-22 02:03:07

问题


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


回答1:


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).




回答2:


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



回答3:


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!




回答4:


For me, I resolved this issue by making sure files are named correctly. Needed to start with the word test or end with the word test. This really depends your "Test File name mask" under test configurations. For me, mine was: */{_test,test_*}.rb

Ex: test_case_01.rb or case_01_test.rb



来源:https://stackoverflow.com/questions/7539232/rubymine-unable-to-attach-test-reporter-to-test-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!