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?
请先登录再写评论。
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.:
If some gem is installed in Ruby SDK that doesn't mean that it is loaded on run-time.
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?
""
""
Hi,
You are using Rails 3.1 therefore you are also using bunlder. So just add the following line in Gemfile:
thank you for your answer...
i did it, but i still have the issue
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
The "already initialised constant WFKV_" message seems to be a known problem in rack 1.3.4. The answers seem to be:
Hope this helps...
Fred
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
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
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.
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
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
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.
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
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.
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
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
Instead better to use relative paths, like
and launch tests with extended load path - you need to add 'test' folder in loadpath, so
ruby -Itest -Ilib test/unit/mailer_test.rb
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. ;-)
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>'
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.
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
Anymore ideas here? ;-)
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.
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.
Ah, okay, thanks, will try that out. Wonder why '-Itest' is not the default for a rails project in Ruby Mine then?
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
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.
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.
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?
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
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?