4

我有一个带有一些测试的简单 Xcode 项目。当我使用 xctool 通过简单的命令进行构建时:

path/to/xctool.sh \
  -project YourProject.xcodeproj \
  -scheme YourScheme \
  build

它工作得很好。但是,当我尝试构建和运行测试时,尝试运行它们时出现错误。

我建立测试:

path/to/xctool.sh \
  -project YourProject.xcodeproj \
  -scheme YourScheme \
  build-tests

我运行测试:

path/to/xctool.sh \
  -workspace YourProject.xcodeproj \
  -scheme YourScheme \
  run-tests

这抱怨我需要指定 SDK,所以我附加了-sdk iphonesimulator. 然后我收到以下错误:

    Failed to query the list of test cases in the test bundle: sh: /Applications/Xcode.app/usr/bin/xcodebuild: No such file or directory
    /Applications/Xcode.app/usr/bin/xcodebuild fails with 32512 - Unknown error: 32512
2015-03-16 09:53:52.953 sim[15747:4298865] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'launch path not accessible'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff8d0fa66c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff86cc776e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff8d0fa51d +[NSException raise:format:] + 205
    3   Foundation                          0x00007fff8b7186ac -[NSConcreteTask launchWithDictionary:] + 444
    4   sim                                 0x000000010f713584 sim + 5508
    5   sim                                 0x000000010f714a3a sim + 10810
    6   libdyld.dylib                       0x00007fff86eea5c9 start + 1
    7   ???                                 0x0000000000000005 0x0 + 5
)
libc++abi.dylib: terminating with uncaught exception of type NSException

我不明白为什么 xctool 在 /Applications/Xcode.app/usr/bin/xcodebuild 中寻找测试用例?

4

0 回答 0