首页 > 解决方案 > Objective-C Travis 因“测试运行程序在开始测试执行之前退出”而失败

问题描述

这是我在.travis.yml文件中的代码,运行构建通过后,但我发现测试失败。我对此一无所知,并阻止了我几天,感谢您的帮助。谢谢

--- 错误如下 ---

2018-12-20 05:57:42.698 xcodebuild[2394:8186] [MT] 
IDETestOperationsObserverDebug: (CB8F382A-5B77-4BDA-BC4F-6EDF7B7DB822) 
Beginning test session aaaaTests-CB8F382A-5B77-4BDA-BC4F-6EDF7B7DB822 at 2018- 
12-20 05:57:42.698 with Xcode 10A255 on target <DVTiPhoneSimulator: 
0x7f86387e49d0> {
    SimDevice: iPhone 6 (B25EC6DB-0B2F-4920-B6C2-8560331BA779, iOS 9.1, Booted)
} (9.1 (13B143))
2018-12-20 05:57:53.744 xcodebuild[2394:8186] [MT] 
IDETestOperationsObserverDebug: 11.068 elapsed -- Testing started completed.
2018-12-20 05:57:53.744 xcodebuild[2394:8186] [MT] 
IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2018-12-20 05:57:53.744 xcodebuild[2394:8186] [MT] 
IDETestOperationsObserverDebug: 11.068 sec, +11.068 sec -- end
2018-12-20 05:57:53.746 xcodebuild[2394:8186] Error 
Domain=IDETestOperationsObserverErrorDomain Code=6 "Early unexpected exit, 
operation never finished bootstrapping - no restart will be attempted" 
UserInfo={NSLocalizedDescription=Early unexpected exit, operation never 
finished bootstrapping - no restart will be attempted, 
NSUnderlyingError=0x7f86389df930 {Error 
Domain=IDETestOperationsObserverErrorDomain Code=5 "Test runner exited before 
starting test execution." UserInfo={NSLocalizedDescription=Test runner exited 
before starting test execution., NSLocalizedRecoverySuggestion=If you believe 
this error represents a bug, please attach the result bundle at 
/Users/travis/Library/Developer/Xcode/DerivedData/aaaa- 
bdscsxnorhzvygafnsqdiqoriugx/Logs/Test/Run-aaaa-2018.12.20_05-57-22- 
+0000.xcresult}}}
Testing failed:
    aaaa.app (2488) encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. Underlying error: Test runner exited before starting test execution.)
** TEST FAILED **
The command "set -o pipefail && xcodebuild -workspace aaaa.xcworkspace -scheme aaaa -destination platform\=iOS\ Simulator,OS\=9.1,name\=iPhone\ 6 build test | xcpretty" exited with 65.
Done. Your build exited with 1.

---我的代码如下---

language: objective-c
osx_image: xcode10
xcode_workspace: aaaa.xcworkspace
xcode_scheme: aaaa
xcode_destination: platform=iOS Simulator,OS=9.1,name=iPhone 6

before_install:
  - pod repo update
  - npm install ios-sim -g
  - ios-sim start --devicetypeid "com.apple.CoreSimulator.SimDeviceType.iPhone-6, 9.1"

标签: objective-cios-simulatortravis-ci

解决方案


该问题可以通过以下步骤解决:

更改文件中的版本osx_image并重.travis.yml

// if xcode10.1 build failed, you can change to other version, like xcode9.4
osx_image: xcode10.1

Travis 支持 xcode 版本列表: https ://docs.travis-ci.com/user/languages/objective-c/


推荐阅读