我在TeamCity(版本6.0.2)中运行了一些ruby测试,但是从1.8.6升级到ruby 1.9.2后,看起来它无法识别测试测试失败并成功一次。
我能看到的唯一区别是输出格式有所改变,但我不知道为什么?
1.8.6工作版
[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版本错误
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...]
rake runner或test-unit gem可能是罪魁祸首吗?
rake目标看起来像这样,并且在两个版本之间没有更改
require 'rake' require 'rake/testtask' Rake::TestTask.new(:test_tb) do |t| t.pattern = 'tryggare/**/test_*.rb' t.verbose = true t.warning = false end
可能相关的信息
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使用自己的单元测试运行器并使用RUBYLIB环境变量加载它。您需要确保您的程序不会清除此环境变量,但您可以将路径附加到它。
答案 0 :(得分:1)
对于Ruby 1.9,TeamCity的官方立场是您必须安装测试单元gem才能正确报告。 http://youtrack.jetbrains.net/issue/TW-14984
对于Ruby 1.8.6,官方的立场是它是可选的,但是我(和其他人)发现在某些情况下你必须完全卸载才能正确报告。
(我知道这些信息在评论中有所涉及,但似乎更准确,它被写成“答案”)