错误
/Users/xxx/xxx/Test/Test-xxx-2019.05.05_19-07-04-+0800.xcresult/1_Test/Diagnostics/xxx-85CAC335-C0D4-454E-B265-51BCC3DBB527/xxx-6Exxx296-AB25-4C16-AA9C-B99A418520A4/Session-xxx-2019-05-05_190730-6OhK70.log
2019-05-05 19:07:30.549 xcodebuild[68239:1368736] [MT] IDETestOperationsObserverDebug: (3B45E874-2854-47C9-9FED-24F4E0573153) Beginning test session xxx-3B45xxx74-2854-47C9-9FED-24F4E0573153 at 2019-05-05 19:07:30.550 with Xcode 10E125 on target <DVTLocalComputer: 0x7fe9de06dc20 (My Mac | x86_64h)> (10.14.4 (18E226))
2019-05-05 19:07:31.517 xcodebuild[68239:1368736] [MT] IDETestOperationsObserverDebug: (3B45E874-2854-47C9-9FED-24F4E0573153) Finished requesting crash reports. Continuing with testing.
2019-05-05 19:07:31.883 xcodebuild[68239:1368736] [MT] IDETestOperationsObserverDebug: 1.386 elapsed -- Testing started completed.
2019-05-05 19:07:31.883 xcodebuild[68239:1368736] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2019-05-05 19:07:31.883 xcodebuild[68239:1368736] [MT] IDETestOperationsObserverDebug: 1.386 sec, +1.386 sec -- end
2019-05-05 19:07:31.884 xcodebuild[68239:1368736] Error Domain=IDELaunchErrorDomain Code=9 "Launch error" UserInfo={NSLocalizedDescription=Launch error, NSLocalizedRecoverySuggestion=There is a problem launching using posix_spawn (error code: 86).}
Testing failed:
xxxx:
xxx.app encountered an error (Failed to install or launch the test runner. (Underlying error: Launch error))
Test session results and logs:
/Users/xxxx/Library/Developer/Xcode/DerivedData/xxx-ezrkbdgtmndmedfkwklsgshqxrma/Logs/Test/Test-xxx-2019.05.05_19-07-04-+0800.xcresult
** TEST FAILED **
ERROR: Job failed: exit status 1
我遇到这种情况,是因为跑单元测试的时候,安装gitlabrunner的那台机器上的Xcode的模拟器(外接真机)没有被指定,在.gitlab-ci.yml文件中指定test的设备就好了,比如,我是这么写的:
// platform:指定设备类型
// id : 设备的UUID
test_project:
stage: test
script:
- xcodebuild test -project xxxxx.xcodeproj -scheme xxxxxxTests -destination 'platform=iOS,id=5015bdba5a11a63c2450xxxxbf495109cfxxxxx' | xcpretty
tags:
- iOS
还可以指定模拟器,可以参考这篇文章
Destination Specifier
希望对以后遇到这个问题的人有帮助。