Jenkins运行xcode单元测试不起作用

时间:2013-05-29 23:54:19

标签: xcode command-line xcode4 jenkins continuous-integration

我正在尝试使用Jenkins为Xcode配置CI。我在控制台中收到以下错误。测试正在运行,我得到了JUnit的测试输出。但它仍然说它不能运行脚本。

Test Suite 'All tests' started at 2013-05-29 23:44:13 +0000
Test Suite '/Users/originate/.jenkins/jobs/Test/workspace/build/Debug-iphonesimulator/HelloWorldTests.octest(Tests)' started at 2013-05-29 23:44:13 +0000
Test Suite 'HelloWorldTests' started at 2013-05-29 23:44:13 +0000

Test Case '-[HelloWorldTests testExample]' started.
Test Case '-[HelloWorldTests testExample]' passed (0.000 seconds).
Test Suite 'HelloWorldTests' finished at 2013-05-29 23:44:13 +0000.
Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite '/Users/originate/.jenkins/jobs/Test/workspace/build/Debug-iphonesimulator/HelloWorldTests.octest(Tests)' finished at 2013-05-29 23:44:13 +0000.
Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'All tests' finished at 2013-05-29 23:44:13 +0000.
Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.001) seconds

Command /bin/sh failed with exit code 1


** BUILD FAILED **


The following build commands failed:
    PhaseScriptExecution "Run Script" build/HelloWorld.build/Debug-iphonesimulator/HelloWorldTests.build/Script-09E70126174EF7C800DFCE82.sh
(1 failure)
Build step 'Xcode' marked build as failure
Recording test results
Build step 'Upload to Testflight' marked build as failure
Finished: FAILURE

修改 除了上述错误外,在命令行上运行单元测试还会出现以下错误:

Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out." UserInfo=0x7fb9d35003a0 {NSLocalizedDescription=Simulator session timed out.}

我正在运行的单元测试的脚本是:

#!/usr/bin/env ruby
if ENV['SL_RUN_UNIT_TESTS'] then
    launcher_path = "ios-sim"
    test_bundle_path= File.join(ENV['BUILT_PRODUCTS_DIR'], "#{ENV['PRODUCT_NAME']}.#{ENV['WRAPPER_EXTENSION']}")

    environment = {
        'DYLD_INSERT_LIBRARIES' => "/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection",
        'XCInjectBundle' => test_bundle_path,
        'XCInjectBundleInto' => ENV["TEST_HOST"]
    }

    environment_args = environment.collect { |key, value| "--setenv #{key}=\"#{value}\""}.join(" ")

    app_test_host = File.dirname(ENV["TEST_HOST"])
    passed = system("#{launcher_path} launch \"#{app_test_host}\" #{environment_args} --args -SenTest All #{test_bundle_path}")
    exit(1) if !passed
    exit 0
else
    puts "SL_RUN_UNIT_TESTS not set - Did not run unit tests!"
    exit 0
end

请帮帮我。 谢谢!

0 个答案:

没有答案