Unable to run tests in RubyMine 3.2.1 under Ruby 1.9.2

Hi

Previously under 1.8.7 I could run unit tests (including focused tests) inside RubyMine. Since upgrading to 1.9.2/Rails 3.0.7 however I'm no longer able to do this.  I get the error below, which appears to be to do with Test::Unit.  Running the tests in the terminal is fine.  Here's the error:

/Applications/RubyMine 3.2.1.app/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner_events.rb:175:in `test_finished': Finished test '(MyTest)'[(MyTest)] doesn't correspond to current running test 'MyTest]! (Rake::TeamCity::InnerException)
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@development/gems/test-unit-1.2.3/lib/test/unit/util/observable.rb:78:in `call'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@development/gems/test-unit-1.2.3/lib/test/unit/util/observable.rb:78:in `block in notify_listeners'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@development/gems/test-unit-1.2.3/lib/test/unit/util/observable.rb:78:in `each'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@development/gems/test-unit-1.2.3/lib/test/unit/util/observable.rb:78:in `notify_listeners'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@development/gems/test-unit-1.2.3/lib/test/unit/ui/testrunnermediator.rb:47:in `block in run_suite'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@global/gems/activesupport-3.0.7/lib/active_support/testing/setup_and_teardown.rb:93:in `run'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@fdevelopment/gems/test-unit-1.2.3/lib/test/unit/testsuite.rb:34:in `block in run'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@fdevelopment/gems/test-unit-1.2.3/lib/test/unit/testsuite.rb:33:in `each'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@fdevelopment/gems/test-unit-1.2.3/lib/test/unit/testsuite.rb:33:in `run'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@fdevelopment/gems/test-unit-1.2.3/lib/test/unit/testsuite.rb:34:in `block in run'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@fdevelopment/gems/test-unit-1.2.3/lib/test/unit/testsuite.rb:33:in `each'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@fdevelopment/gems/test-unit-1.2.3/lib/test/unit/testsuite.rb:33:in `run'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@fdevelopment/gems/test-unit-1.2.3/lib/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
     from /Applications/RubyMine 3.2.1.app/rb/testing/patch/testunit/test/unit/ui/testrunnermediator.rb:41:in `run_suite'
     from /Applications/RubyMine 3.2.1.app/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner.rb:108:in `start_mediator'
     from /Applications/RubyMine 3.2.1.app/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner.rb:96:in `start'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@development/gems/test-unit-1.2.3/lib/test/unit/ui/testrunnerutilities.rb:29:in `run'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@development/gems/test-unit-1.2.3/lib/test/unit/autorunner.rb:216:in `run'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@development/gems/test-unit-1.2.3/lib/test/unit/autorunner.rb:12:in `run'
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@development/gems/test-unit-1.2.3/lib/test/unit.rb:278:in `block in '

9 comments
Comment actions Permalink

Is no-one else seeing such a problem?

0
Comment actions Permalink

what happens if you run:

  rake test


on the cmdline?

0
Comment actions Permalink

wanchic wrote:

what happens if you run:

  rake test

on the cmdline?

Works fine.  Same running isolated tests on the cmd line.

It's only a problem since I upgraded to Ruby 1.9.2

0
Comment actions Permalink

Would you mind taking a look at Issue:309199 (http://devnet.jetbrains.net/thread/309199). This might be related to a problem I just reported to RubyMine, but no replies as of yet. You could try running

ruby -Itest /Applications/RubyMine 3.2.1.app/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner_events.rb


on cmdline to see if you recieve the same errors as you previously mentioned. Let me know what happens.

Eric

0
Comment actions Permalink

Hi

Thanks for helping.  I'm afraid this doesn't work:


$ ruby -Itest /Applications/RubyMine\ 3.2.1.app/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner_events.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- teamcity/utils/service_message_factory (LoadError)
     from <internal:lib/rubygems/custom_require>:29:in `require'
     from /Applications/RubyMine 3.2.1.app/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner_events.rb:20:in `<main>'


Olly

0
Comment actions Permalink

Thanks for testing this out. This helps confirm my sucsipions. I also assume you are using a mac, which demos this is not a ubuntu-only issue.

I do not believe the problem is not directly related to Ruby 1.9.2 since this used to work for quite a while on 1.9.2-180. This only started happening with some later versions of: test-unit, shoulda, rake, rails. I'm still fresh on RoR, but  I think the issue comes down to: rake works, rake sets up the sets environment properly, ruby's Itest doesn't. RubyMine should give us the option to modifiy this. Technically, you can create rake configs in RubyMine, but not at easliy and as integrated. We need to modify this somehow. I will comment on this post back on Issue:309199 (http://devnet.jetbrains.net/thread/309199).

Until then, my overall suggestion is to use rake. Issue:309199 (http://devnet.jetbrains.net/thread/309199) shows how to do single tests in rake.

Eric

0
Comment actions Permalink

I cannot reproduce it in RubyMine 3.2.1 + ruby-1.9.2-pp180+ rails 3.0.7 + test-unit 1.2.3
Screen Shot 2011-08-04 at 5.40.05 PM.png
I attached sample project to this post, please check it



Attachment(s):
testUnit192issue.zip
0
Comment actions Permalink

Roman,
  Thanks for mentioning to reset my settings. (^_^). Well, I have to digress. Someone must have updated something (gem related) becuase now it ALL works again. I should have mentioned that the errors started to stem from unit testing scopes, needing to use exact database activatiy. As I migrated your code (Roman) from fixtures to factories, and finding it still worked, I re-ran my tests from my orginal code and whoa-la. Working.
Also, my simpleCov is combining all tests properly again.

Olly, perhaps you can do a 'bundle update' on your code and see what what gem(s) got updated and if you can successfully test once again.

Eric

0
Comment actions Permalink

/Applications/RubyMine 3.2.1.app/rb/testing/patch/testunit/test/unit/ui/teamcity/testrunner_events.rb:175:in `test_finished': Finished test '(MyTest)'[(MyTest)] doesn't correspond to current running test 'MyTest]! (Rake::TeamCity::InnerException)
     from /Users/lylo/.rvm/gems/ruby-1.9.2-p180@development/gems/test-unit-1.2.3/lib/test/unit/util/observable.rb:78:in `call'
   

The error occurs when test framework incorrectly reports test/suite started/finished events. It may happen due to bugs/regressions/unsupported API in test framework (e.g. test-unit, cucumber, rspec gems). Probably in some cases bugs in your tests may lead to test framework incorrect behaviour. Please let me know if the problem will come back.

0

Please sign in to leave a comment.