Rails and test:units issue

Hi,

after running:

[12:42:42]: [Execute test] Execute db:test:prepare
[12:42:42]: [Execute db:test:prepare] Execute db:test:purge
[12:42:42]: [Execute db:test:prepare] Execute db:test:load
[12:42:42]: [Execute db:test:load] Execute db:schema:load
[12:42:43]: [Execute test] Execute test:prepare


I get:


[12:42:43]:
[Execute test] Execute test:units (4s)
[12:42:48]: [Execute test:units] /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/patch/testunit/minitest/unit.rb:12:in `singletonclass': undefined method `autorun' for class `Class' (NameError)
[12:42:48]: [Execute test:units]      from /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/patch/testunit/minitest/unit.rb:11:in `<class:Unit>'
[12:42:48]: [Execute test:units]      from /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/patch/testunit/minitest/unit.rb:10:in `<module:MiniTest>'
[12:42:48]: [Execute test:units]      from /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/patch/testunit/minitest/unit.rb:9:in `<top (required)>'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `block in load_dependency'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/test/unit.rb:3:in `<top (required)>'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `block in load_dependency'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/shoulda-2.11.3/lib/shoulda/integrations/test_unit.rb:1:in `<top (required)>'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `block in load_dependency'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/shoulda-2.11.3/lib/shoulda.rb:8:in `<top (required)>'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `block in require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/bundler-1.0.18/lib/bundler.rb:120:in `require'
[12:42:48]: [Execute test:units]      from /home/tc/tc-6.5.3/buildAgent/work/f44a5e1c1a1a4b2c/config/application.rb:7:in `<top (required)>'
[12:42:48]: [Execute test:units]      from /home/tc/tc-6.5.3/buildAgent/work/f44a5e1c1a1a4b2c/config/environment.rb:2:in `require'
[12:42:48]: [Execute test:units]      from /home/tc/tc-6.5.3/buildAgent/work/f44a5e1c1a1a4b2c/config/environment.rb:2:in `<top (required)>'
[12:42:48]: [Execute test:units]      from /home/tc/tc-6.5.3/buildAgent/work/f44a5e1c1a1a4b2c/test/test_helper.rb:2:in `require'
[12:42:48]: [Execute test:units]      from /home/tc/tc-6.5.3/buildAgent/work/f44a5e1c1a1a4b2c/test/test_helper.rb:2:in `<top (required)>'
[12:42:48]: [Execute test:units]      from test/unit/comment_test.rb:1:in `require'
[12:42:48]: [Execute test:units]      from test/unit/comment_test.rb:1:in `<top (required)>'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `block in <main>'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
[12:42:48]: [Execute test:units]      from /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `<main>'
[12:42:48]: [Execute test:units] RuntimeError: Command failed with status (1): [/home/tc/.rvm/rubies/ruby-1.9.2-p290/bin/r...] Stacktrace: /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:995:in `block in sh' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:1010:in `call' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:1010:in `sh' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:1094:in `sh' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:1029:in `ruby' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:1094:in `ruby' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/railties-3.0.7/lib/rails/test_unit/testing.rake:26:in `block (2 levels) in define' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/railties-3.0.7/lib/rails/test_unit/testing.rake:11:in `block in define' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:636:in `call' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:631:in `each' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:631:in `execute' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:260:in `block in execute' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:266:in `execute' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain' /home/tc/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:235:in `block in my_invoke_with_call_chain' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:234:in `my_invoke_with_call_chain' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/railties-3.0.7/lib/rails/test_unit/testing.rake:78:in `block (2 levels) in <top (required)>' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/railties-3.0.7/lib/rails/test_unit/testing.rake:76:in `collect' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/railties-3.0.7/lib/rails/test_unit/testing.rake:76:in `block in <top (required)>' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:636:in `call' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:631:in `each' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:631:in `execute' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:260:in `block in execute' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:266:in `execute' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain' /home/tc/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:604:in `each' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain' /home/tc/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:235:in `block in my_invoke_with_call_chain' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:234:in `my_invoke_with_call_chain' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:2029:in `each' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling' /home/tc/.rvm/gems/ruby-1.9.2-p290@gnet/gems/rake-0.8.7/lib/rake.rb:1998:in `run' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:179:in `run' /home/tc/tc-6.5.3/buildAgent/plugins/rake-runner/lib/rb/runner/rakerunner.rb:40:in `<main>'


When i'm doing bundle exec rake unit:tests on the same environment - everything is fine.

Any ideas?

4 comments
Comment actions Permalink

I am experiencing exactly the same issue after an update to 6.5.3

0
Comment actions Permalink

Hi guys,

Please use test-unit gem in your project instead of minitest. Origingaly Test::Unit framework was bundlen in ruby 1.8.x sdk, but then it was extracted to a separate 'test-unit' gem. Ruby 1.9.x sdks doesn't include full feature Test::Unit support, just some mock implementation called "Minitest". We've added detection for minitest framework which should recommend user to switch to test::unit, but seems smth doesn't work in 1.9.2-p290, I filled an issue - http://youtrack.jetbrains.net/issue/TW-18056

Unfortunatelly Minitest framework doesn't suppprt custom pluggable test reporters, so you have 2 options

1. Disable 'test-unit' framework suppport in runner build configuration settings and you will get boring console minitest output in build log. Becaue we cannot plug in minitest framework.
2. Force your application to use 'test-unit' gem (it is compatible both with 1.8.x and 1.9.x ruby interpreters) e.g. add dependency in Gemfile. And then TeamCity will plugin it's custom test reporter and will recognize tests/suites and show usual nice report

0
Comment actions Permalink

I went with option 2. In order to do this I simply added

gem "test-unit"

require "test:unit"

to the top of my rakefile.

Thanks for your help on this!

0
Comment actions Permalink

Should IDEA + TC be able to handle minitest using minitest-reporters?

0

Please sign in to leave a comment.