Test::Unit in Ruby 1.9.2
Hi all,
from the available information I understood that there are currently some issues with the test runner for Test::Unit and Ruby 1.9.2.
I'm currently running tests on a Ruby library that has no gemfile (basically it's plain Ruby code). I attached the full test-unit-2.1.2 gem
and on running the tests (e.g. by pressing right mouse button and choosing Run "...") I'm getting the "no tests found" message
from the test runner, but the console shows that all my tests have been run successfully.
I read about a solution that suggests to modify the gemfile, but in my case I have no gemfile, is there a way how I can still see the
correct output of the test runner?
I'm on a Linux machine (Ubuntu) using RubyMine EAP 102.217.
Thanks in advance,
Hans
请先登录再写评论。
Hello Hans,
"Attaching" is just for RubyMine code analysis features. RubyMine doesn't activate attached gems on run-time. You need activate gem manually. E.g.
It is important to activate test-unit gem before requiring 'test/unit' script, otherwise default mock test unit support will be used.
This message mean that our GUI test runner doesn't receive any message about test start/finished event because our reporter wasn't attached on run-time. E.g all output was send to $stdout using some default console results reporter. See my previous comment related to manual gem activating.
P.S: in Rails 2.x applications activate gem using gem command in config/environment.rb
Thanks a lot, that did the trick!
Hi, I'm on Rails 3.0.x with Bundler and all that jazz but I still can not get this thing working... This is part of my stacktrace :
/Users/nikosd/.rvm/rubies/ruby-1.9.2-head/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) -Itest /Users/...-1.9/test/unit/user_test.rb
Testing started at 10:41 PM ...
/Users/nikosd/Library/Application Support/IntelliJIdea10/ruby/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner_events.rb:175:in `test_finished': Finished test '(UserTest)'[(UserTest)] doesn't correspond to current running test 'test_at_most_one_system_user_in_the_system(UserTest)'[UserTest.test_at_most_one_system_user_in_the_system]! (Rake::TeamCity::InnerException)
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/util/observable.rb:78:in `call'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/util/observable.rb:78:in `block in notify_listeners'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/util/observable.rb:78:in `each'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/util/observable.rb:78:in `notify_listeners'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/ui/testrunnermediator.rb:49:in `block in run_suite'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/activesupport-3.0.4/lib/active_support/testing/setup_and_teardown.rb:93:in `run'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/testsuite.rb:38:in `block in run'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/testsuite.rb:37:in `each'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/testsuite.rb:37:in `run'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/testsuite.rb:38:in `block in run'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/testsuite.rb:37:in `each'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/testsuite.rb:37:in `run'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/ui/testrunnermediator.rb:48:in `run_suite'
from /Users/nikosd/Library/Application Support/IntelliJIdea10/ruby/rb/testing/patch/testunit/test/unit/ui/testrunnermediator.rb:36:in `run_suite'
from /Users/nikosd/Library/Application Support/IntelliJIdea10/ruby/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner.rb:108:in `start_mediator'
from /Users/nikosd/Library/Application Support/IntelliJIdea10/ruby/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner.rb:96:in `start'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/ui/testrunnerutilities.rb:24:in `run'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/autorunner.rb:319:in `run'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit/autorunner.rb:58:in `run'
from /Users/nikosd/.rvm/gems/ruby-1.9.2-head@../gems/test-unit-2.1.2/lib/test/unit.rb:326:in `block in <top (required)>'
1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
Test suite finished: 0.139589 seconds
Process finished with exit code 1
Thank you this solved the problem for me perfectly.
And here is a link to help understand Bundler.
http://pragprog.com/magazines/2010-12/three-bundler-benefits