1
votes

I have some ruby tests running in TeamCity (Version 6.0.2) but after a upgrade to ruby 1.9.2 from 1.8.6 it looks like it doesn't recognize test tests both failed and successful once.

The only difference I can see is that the output format has changed a bit, but I don't know why?

1.8.6 working version

[08:01:35]: in directory: C:\BuildAgent\work\5a0dd55bc3e14c2\webtest\watir
[08:01:36]: (in C:/BuildAgent/work/5a0dd55bc3e14c2/webtest/watir)
[08:01:43]: Execute test_all (13m:13s)
[08:01:43]: [Execute test_all] c:/ruby/bin/ruby.exe -I"lib" "c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test_service.rb"
[08:01:48]: [Execute test_all] Starting.. (36 tests)
[08:01:48]: [Execute test_all] TestCreateAccessAddress (41s)
[08:01:48]: [TestCreateAccessAddress] test_create_access_address_viaeuropa (41s)
[08:01:48]: [test_create_access_address_viaeuropa] ruby_qn://TestCreateAccessAddress.test_create_access_address_viaeuropa
[08:01:50]: [test_create_access_address_viaeuropa] [Test Error Output] ERROR: The process "iexplore.exe" not found.
[08:02:30]: [test_create_access_address_viaeuropa] [Test Output] Open new browser Loggin in. SUCCESS: The process with PID 2696 child of PID 5568 has been terminated. SUCCESS: The process with PID 5568 child of PID 832 has been terminated.
.....
[08:14:53]: [Execute test_all] 36 tests, 33 assertions, 0 failures, 2 errors
[08:14:53]: [Execute test_all] Test suite finished: 784.546 seconds
[08:14:56]: [Execute test_all] RuntimeError: Command failed with status (1): [c:/ruby/bin/ruby.exe -I"lib" "c:/ruby/lib/...] Stacktrace: c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `sh' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `sh' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1029:in `ruby' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `ruby' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/testtask.rb:117:in `define' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/testtask.rb:102:in `define' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `standard_execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `standard_execute' C:/BuildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:260:in `execute' C:/BuildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling' C:/BuildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:266:in `execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain' c:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain' c:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `standard_invoke_with_call_chain' C:/BuildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:235:in `invoke' C:/BuildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling' C:/BuildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:234:in `invoke' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' C:/BuildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run' C:/BuildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' C:/BuildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:179:in `run' C:/BuildAgent/plugins/rake-runner/lib/rb/runner/rakerunner.rb:40
[08:14:56]: Rake aborted!
[08:14:57]: Process exited with code 1
[08:14:58]: Publishing artifacts
[08:14:58]: [Publishing artifacts] Paths to publish: [teamcity-info.xml]
[08:14:58]: [Publishing artifacts] Sending files
[08:14:22]: Build finished

1.9.2@136 Faulty version

3:33:57]: [Updating sources: server side checkout...] Updating C:\BuildAgent\work\5a0dd55bc3e14c2
[13:33:59]: Starting: C:\Ruby192\bin/ruby.exe C:\BuildAgent\plugins\rake-runner\lib\rb\runner\rakerunner.rb --rakefile C:\BuildAgent\work\5a0dd55bc3e14c2\webtest\watir\Rakefile test_tb
[13:33:59]: in directory: C:\BuildAgent\work\5a0dd55bc3e14c2\webtest\watir
[13:34:02]: (in C:/BuildAgent/work/5a0dd55bc3e14c2/webtest/watir)
[13:34:15]: Invoke test_tb (1s)
[13:34:15]: [Invoke test_tb] (first_time)
[13:34:15]: [Invoke test_tb] Execute test_tb (1s)
[13:34:15]: [Execute test_tb] C:/Ruby192/bin/ruby.exe -I"lib" "C:/Ruby192/lib/ruby/1.9.1/rake/rake_test_loader.rb" "tryggare/test_tryggare.rb"
[13:34:16]: [Execute test_tb] Loaded suite C:/Ruby192/lib/ruby/1.9.1/rake/rake_test_loader
[13:34:16]: [Execute test_tb] Started
[13:34:16]: [Execute test_tb] F.
[13:34:16]: [Execute test_tb] Finished in 0.000000 seconds.
[13:34:16]: [Execute test_tb] 1) Failure:
[13:34:16]: [Execute test_tb] test_should_be_able_to_open_browser(TestTryggare) [tryggare/test_tryggare.rb:11]:
[13:34:16]: [Execute test_tb]  expected but was
[13:34:16]: [Execute test_tb] .
[13:34:16]: [Execute test_tb] 2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
[13:34:16]: [Execute test_tb] Test run options: --seed 63773
[13:34:16]: [Execute test_tb] RuntimeError: Command failed with status (1): [C:/Ruby192/bin/ruby.exe -I"lib" "C:/Ruby19...] 

Can the rake runner or test-unit gem be the culprit?

The rake target looks like this and hasn't been changed between the 2 versions

require 'rake'
require 'rake/testtask'


Rake::TestTask.new(:test_tb) do |t|
  t.pattern = 'tryggare/**/test_*.rb'
  t.verbose = true
  t.warning = false
end

Information that might be relevant

Ruby 1.9.1 with Test::Unit gem

http://jamesmead.org/blog/2009-02-02-test-unit-and-minitest-with-different-ruby-versions

Rake Runner uses its own unit tests runner and loads it using RUBYLIB environment variable. You need to ensure your program doesn't clear this environment variable, but you may append your paths to it.

http://confluence.jetbrains.net/display/TCD6/Rake

1
I can reproduce this, or something very similar, with a Rails project on Ruby 1.8.6. I have one project on Rails 2.3.10, which TeamCity cannot render the results for, and another on Rails 2.3.5 which works fine. In both cases, I'm using test-unit 2.1.1 and running tests on Linux VM's. Perhaps there's something else at work here that is not the ruby vm version?Tom Lianza
I also opened an issue on the JetBrains forum: youtrack.jetbrains.net/issue/TW-15616Tom Lianza
Since I was in some kind of hurry I couldn't wait for a solution of this problem. I ended up with porting all of the test cases to Rspec and that works like a charm.orjan

1 Answers

1
votes

For Ruby 1.9, TeamCity's official stance is that you must install the test-unit gem for things to be reported correctly. http://youtrack.jetbrains.net/issue/TW-14984

For Ruby 1.8.6, The official stance is that it's optional, however I (and others) have found that in some cases you have to uninstall it altogether for things to report correctly.

(I know this info is covered in the comments, but seems more accurate that it be written up as "an answer")