Minitest Framework detected, can't load full test framework

New to RubyMine, I am trying to get set up to test some simple test code for Ruby only (no Rails).

I have test-unit gem installed, but when I attempt to run a simple test 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."


It appears that with minitest, I will just get text dump of results, not tie into the IDE GUI.  The test-unit gem IS installed for my project.
What is the meaning of "activate it on runtime"?
Any clues how to get this to work?

0
37 comments

If you are using bunlder - that mention 'test-unit' gem in Gemfile, otherwise you need somewhere to load gem manually in your source code. E.g.:

require 'rubygems'
gem 'test-unit'
require 'test/unit'



If some gem is installed in Ruby SDK that doesn't mean that it is loaded on run-time.
0
Avatar
Permanently deleted user

same issue here
Rails: 3.1
Ruby 1.9.2

Unit Test (nor Rspec) does not work

Minitest Framework detected, can't load full test framework...


in which files should i put those lines of code?

""

require 'rubygems'
gem 'test-unit'
require 'test/unit'

""

0

Hi,

If you are using bunlder - that mention 'test-unit' gem in Gemfile,



You are using Rails 3.1 therefore you are also using bunlder. So just add the following line in Gemfile:

gem 'test-unit'

0
Avatar
Permanently deleted user

thank you for your answer...

i did it, but i still have the issue

rake aborted!
Don't know how to build task 'test'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task_manager.rb:49:in `[]'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:111:in `invoke_task'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
C:/Ruby192/bin/rake:19:in `load'
C:/Ruby192/bin/rake:19:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'

Process finished with exit code 1

0
Avatar
Permanently deleted user

I'm having a similar problem.
running on ubuntu 11.04 partiton on windows core i7 box.
I have previously noted that all my 'rails generate scaffold/controller' commands did not create any of the test files.
If I run Development server my app works fine and all of my table migrations work file.
If I rake test:functional I get the following result:
In one window pane I get the "Unable to attach test reporter to test famework error"
in the other window pane I get the following output:

-------------------------
/home/robinmalmquist/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/robinmalmquist/.rvm/gems/ruby-1.9.2-p180/bin/rake test test:functional
Testing started at 9:55 PM ...

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.

/home/robinmalmquist/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
You have 4 pending migrations:
  20111008055500 CreateLineItems
  20111008060105 CreateCarts
  20111008201951 AddQuantityToLineItems
  20111008211131 CombineItemsInCart
Run "rake db:migrate" to update your database then try again.

Process finished with exit code 1

--------------------------------

If I rake db:migrate my results are as expected all migrations have been run.

Here is the Gemfile used for bundler install/update

require 'rbconfig'
require 'test/unit'
HOST_OS = Config::CONFIG['host_os']

source 'http://rubygems.org'

gem 'rails', '3.1.0'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

#gem 'sqlite3'


group :production do
  gem 'pg'
end
group :development, :test do
  gem 'sqlite3'
end
##
# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails', "  ~> 3.1.0"
  gem 'coffee-rails', "~> 3.1.0"
  gem 'uglifier'
end

gem 'jquery-rails'
if HOST_OS =~ /linux/i
  gem 'therubyracer', '>= 0.8.2'
end

gem 'test-unit'

gem "rspec-rails", ">= 2.6.1", :group => [:development, :test]
gem "factory_girl_rails", ">= 1.2.0", :group => :test
gem "cucumber-rails", ">= 1.0.2", :group => :test
gem "capybara", ">= 1.1.1", :group => :test
gem "database_cleaner", ">= 0.6.7", :group => :test
gem "launchy", ">= 2.0.5", :group => :test
gem "guard", ">= 0.6.2", :group => :development
case HOST_OS
  when /darwin/i
    gem 'rb-fsevent', :group => :development
    gem 'growl', :group => :development
  when /linux/i
    gem 'libnotify', :group => :development
    gem 'rb-inotify', :group => :development
  when /mswin|windows/i
    gem 'rb-fchange', :group => :development
    gem 'win32console', :group => :development
    gem 'rb-notifu', :group => :development
end
gem "guard-bundler", ">= 0.1.3", :group => :development
gem "guard-rails", ">= 0.0.3", :group => :development
gem "guard-livereload", ">= 0.3.0", :group => :development
gem "guard-rspec", ">= 0.4.3", :group => :development
gem "guard-cucumber", ">= 0.6.1", :group => :development
gem "devise", ">= 1.4.5"
gem "frontend-helpers"

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

group :test do
  # Pretty printed test output
  gem 'turn', :require => false
end

----------------

Any help would be appreciated.
R

0
Avatar
Permanently deleted user

The "already initialised constant WFKV_" message seems to be a known problem in rack 1.3.4.  The answers seem to be:

  1. Go back to rack 1.3.3
  2. This message is only a warning... ignore it.  This is easily done if you are executing outside of an IDE, but RubyMine treats it as an error, and doesn't seem to want to continue.
  3. Wait for the next release of rack(I believe the source is already fixed but executable not yet released).

Hope this helps...
Fred

0

You can add something like lines below to your Rakefile:

require 'rake/testtask'

Rake::TestTask.new(:test) do |test|
   test.libs << 'lib' << 'test' # specify folders with your code
   test.pattern = 'test/**/test_*.rb' # specify pattern of files containing tests
end

0
Avatar
Permanently deleted user

Dima,

Thanks for getting back to me.

question to make sure I understand what I should do here

----
   test.libs << 'lib' << 'test' # specify folders with your code
   test.pattern = 'test/**/test_*.rb' # specify pattern of files containing tests
----

1. Will 'test' be sufficient if that is the sub-directory that my test files will go.
2. I'm confused by the test patttern. I usually see *_test.rb as in:
/home/robinmalmquist/rmRRapps/demo/test/functional/carts_controller_test.rb
so test_*.rb looks strange?
2b. does the ** generate the unit, functional and integration directoriies?

3. How do I get the test files to generate? Do I
rails generate model cart  #etc
??? over the top of what I have already done. Will it wipe out my controller and view files?

Robin

0

Hi Robin,
1. 'test' may be sufficient for you. 'libs' setting specify additional entries to LOAD_PATH - list of directories where ruby searches for sources. In case your project does not contain a 'lib' folder or if it's been added to LOAD_PATH separately. Run rake with both settings and see which is working for you.
2. Specify test pattern you use. That is what this parameter is present here for. In your case 'test/**/*test.rb' should work.
2b. '**' will search in all subdirectories of 'test' directory including 'unit', 'integration' etc. If you ommit '**' this, then only files stored directly in the 'test' directory will be processed.
3. Yes, tests will be generated by default when you generate a model. Don't worry it will not touch views or controllers. Generator will also prompt before overwriting existing file so all is under your control.

0
Avatar
Permanently deleted user

Thanks Dima,

All my questions answered. I will try them out today.

Any idea how this test generation wasn't happening? I hadn't touched Rakefile. ??

Robin

0
Avatar
Permanently deleted user

Similar problem here, but I do have gem 'test-unit' in my gemfile.

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.



Tests are running fine if I run the whole file. But individual test won't work and give me

No Tests were found.
Empty test suite.

Please advice!

Thanks,
Nico
0

But individual test won't work and give me

No Tests were found.
Empty test suite.

Could you suggest detatiled reproducing scenario? And attach full console output (including cmdline)* According to the warning Minitest is loaded on run-time in your application instead of test-unit. By the way we are working on Minitest support an it will be available in some near futute.

0
Avatar
Permanently deleted user

Its a rather big project, but I can try reproducing this in a test app at some point:

Here is full console output for now, trying to run a single test:

/Users/nico/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/nico/Rails/yousty/test/unit/mailer_test.rb
Testing started at 12:54 ...

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.

Running single test : test: fr-CH mails should create company profile order confirmation fr-CH.
Empty test suite.

0 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications

Test suite finished: 0.000338 seconds
Coverage report generated for Unit Tests to /Users/nico/Rails/yousty/coverage. 2565 / 8319 LOC (30.83%) covered.
Empty test suite.


Process finished with exit code 0

0

Could you launch the test from console and compare results? Does your tests requite minitest/autorunner or etc (e.g. via test_helper.rb),  does your tests extens MiniTest::TestUnit class or etc.

0
Avatar
Permanently deleted user

Actually I have trouble running the test on the console. Running all (unit) tests via rake test(:units) works fine.
But when I do:

ruby -Ilib:test test/unit/mailer_test.rb

I get

<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- test/unit/../test_helper (LoadError)
 from <internal:lib/rubygems/custom_require>:29:in `require'
 from test/unit/mailer_test.rb:3:in `<main>'



So somehow it doesn't like the way I require the test helper:

require "#{File.dirname(__FILE__)}/../test_helper"

Any ideas?

Thanks,
Nico
0
Avatar
Permanently deleted user

Oh, that is actually running the whole file, not even the single test...
However, when I try to run an indivdual test I expectedly get the same error:

ruby -Ilib:test test/unit/mailer_test.rb -n test_name

0

require "#{File.dirname(__FILE__)}/../test_helper"

Instead better to use relative paths, like

require "test_helper"



and launch tests with extended load path - you need to add 'test' folder in loadpath, so

ruby -Itest -Ilib test/unit/mailer_test.rb
0
Avatar
Permanently deleted user

Thanks for the tipps, I actually tried using require "test_helper" before, but had lots of issues,
so I swapped back to require "#{File.dirname(__FILE__)}/../test_helper"

But I will try again...  

And report here. ;-)

0
Avatar
Permanently deleted user

Okay, I get another erro now:

<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- simplecov (LoadError)
 from <internal:lib/rubygems/custom_require>:29:in `require'
 from /Users/nico/Rails/yousty/test/test_helper.rb:2:in `<top (required)>'
 from <internal:lib/rubygems/custom_require>:29:in `require'
 from <internal:lib/rubygems/custom_require>:29:in `require'
 from test/unit/mailer_test.rb:4:in `<main>'

0
Avatar
Permanently deleted user

okay, when I remove the SimpleCov stuff i can run the test on the command line but it says 0 test run, just like it used to do in Ruby mine:


localhost:yousty nico$ ruby -Itest -Ilib test/unit/mailer_test.rb -n test_invitation_mail_renders_template
Loaded suite test/unit/mailer_test
Started




Finished in 9.6e-05 seconds.


0 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed


0.00 tests/s, 0.00 assertions/s






However in Ruby Mine the test runner doesn't start at all anymore:

/Users/nico/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/nico/Rails/yousty/test/unit/mailer_test.rb --name=test_invitation_mail_renders_template
Testing started at 14:30 ...
/Users/nico/Rails/yousty/test/unit/mailer_test.rb:4:in `require': no such file to load -- test_helper (LoadError)
 from /Users/nico/Rails/yousty/test/unit/mailer_test.rb:4:in `<top (required)>'
 from -e:1:in `load'
 from -e:1:in `<main>'


Process finished with exit code 1




This is the issue I had earlier, that's why I was using require "#{File.dirname(__FILE__)}/../test_helper" which works.
0
Avatar
Permanently deleted user

My problem is that the generator scripts do not create any test files. I have added "gem 'test-unit'" into my Gemfile but that doesn't change anything.

'rails generate controller User string:name" does not create any (none) test files in the test directory, no yaml files in the fiixtures directory, no Unit tests, no Functional tests, nothing.
I have to add the tests myself.

Robin

0
Avatar
Permanently deleted user

Anymore ideas here? ;-)

0

localhost:yousty nico$ ruby -Itest -Ilib test/unit/mailer_test.rb -n test_invitation_mail_renders_template


How "test_invitation_mail_renders_template" method is defined? Using spec like DSL or using ruby method? Most likely minitest cannot find test which matches this filter.
If -n argument is regexp sting (e.g.: /.*/) than MiniTest uses regexp filter, otherwise it checks that test name is equal to -n argument. When tests defined using spec like DSL their actual names will be smth like test_0001_test_invitation_mail_renders_template.
0

/Users/nico/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/nico/Rails/yousty/test/unit/mailer_test.rb --name=test_invitation_mail_renders_template
Testing started at 14:30 ...
/Users/nico/Rails/yousty/test/unit/mailer_test.rb:4:in `require': no such file to load -- test_helper (LoadError)
from /Users/nico/Rails/yousty/test/unit/mailer_test.rb:4:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'


Process finished with exit code 1

The same problem as in console - add '-Itest' to ruby interpreter arguments (see run configuration setting), more over you can save these custom settings in your project run confugration defaults.

0
Avatar
Permanently deleted user

Ah, okay, thanks, will try that out. Wonder why '-Itest' is not the default for a rails project in Ruby Mine then?

0
Avatar
Permanently deleted user

Actually one of my co-workers recommended me to use require_relative "../test_helper".
That works fine now when running all tests in a file, both in console, and in RubyMine - without changing any settings.

However, the test output in the console is a bit funny:


$ ruby -Itest -Ilib test/unit/mailer_test.rb
Loaded suite test/unit/mailer_test
Started




Finished in 8.767672 seconds.


19 tests, 132 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed


So it says 0% passed, which is wrong.

Trying to run a single test (ruby function style, like def test_xyz) in Ruby Mine or on the command line still doesn't work.

Ruby Mine output:

No Tests were found.

Here is the output:


/Users/nico/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/nico/Rails/yousty/test/unit/mailer_test.rb --name=test_welcome
Testing started at 19:57 ...

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.


0 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications

Test suite finished: 8.9e-05 seconds
Empty test suite.


Process finished with exit code 0


Command line output:


$ ruby -Itest -Ilib test/unit/mailer_test.rb -n=test_welcome
Loaded suite test/unit/mailer_test
Started




Finished in 9.8e-05 seconds.


0 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed


0.00 tests/s, 0.00 assertions/s

0

Robin,

Rails generator provided by Rails community, not by RubyMine, and RubyMine just launches it. I suppose better to ask Rails community what it is confiugred wrong in your application.

0

Minitest isn't supported by RubyMine yet, but we are working on it. See http://youtrack.jetbrains.net/issue/RUBY-7186 issue. At the moment I submitted a pull-request to minitest-reporters gem, which will enable RubyMine graphical test runner. In next 4.0 EAP RubyMine will support single tests launching as in test-unit. Unfortunatelly Minitest is still limited version of Test::Unit with lack of features, e.g the framework doesn't report test location (file path and colon number) so navigation from test tree to source wont be available in RubyMine.

0
Avatar
Permanently deleted user

Yes, I understand this, but the thing is that I do have the unit-test gem in my gemfile. So why is it not used by ruby mine?

0

Is bundle exec emulation is enabled in the test run configuration settings? (Run | Edit Confiugrations.. , chose you run configuration, check "Bundler" tab)?

Also try to execute test in console using bundle exec:

bundle exec ruby -Itest -Ilib test/unit/mailer_test.rb -n=test_welcome

Yes, I understand this, but the thing is that I do have the unit-test gem in my gemfile. So why is it not used by ruby mine?

I don't understand whether you get Test::Unit results output or Minitest one in console. Does your test helper requires smth from "minitest" folder? Or does your tests extends Minitest::TestCase instead of Test::Unit::TestCase?

0

Please sign in to leave a comment.