我正在尝试让单元测试在 CI (Jenkins) 中运行。我在网上看到了这篇文章,其中有一些技巧可以让测试在命令行中运行。我在一个具有单元测试默认设置的空项目上进行了尝试,并且那里的说明工作得很好,但是当我尝试在具有单元测试设置的现有项目上执行此操作时,我遇到了一个模棱两可的错误:
/bin/sh -c /Users/jzhwu/smule/magicpiano/build/MagicPiano.build/Debug-iphonesimulator/MagicPianoTest.build/Script-7C0B24BE155310BE001AC942.sh
/Applications/Xcode.app/Contents/Developer/Tools/RunPlatformUnitTests.include:266: note: Started tests for architectures 'i386'
Run unit tests for architecture 'i386' (GC OFF)
/Applications/Xcode.app/Contents/Developer/Tools/RunPlatformUnitTests.include:273: note: Running tests for architecture 'i386' (GC OFF)
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support
2012-05-11 15:10:39:247 MP-Debug[24398:17003] loading model magic
2012-05-11 15:10:39:250 MP-Debug[24398:17003] loading model magic-analytics
2012-05-11 15:10:39.264 MP-Debug[24398:17003] Unresolved error Error Domain=NSCocoaErrorDomain Code=512 "The operation couldn’t be completed. (Cocoa error 512.)" UserInfo=0xa2c5ce0 {reason=Failed to create file; code = 2}, {
reason = "Failed to create file; code = 2";
}
2012-05-11 15:10:39.264 MP-Debug[24398:17003] Try deleting and reinstalling the app to fix this issue
/Applications/Xcode.app/Contents/Developer/Tools/RunPlatformUnitTests.include: line 269: 24398 Abort trap: 6 "${TEST_HOST}" ${TEST_HOST_FLAGS} ${OTHER_TEST_FLAGS}
/Applications/Xcode.app/Contents/Developer/Tools/RunPlatformUnitTests.include:339: error: Test host '/Users/jzhwu/smule/magicpiano/build/Debug-iphonesimulator/MP-Debug.app/MP-Debug' exited abnormally with code 134 (it may have crashed).
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution "Run Script" build/MagicPiano.build/Debug-iphonesimulator/MagicPianoTest.build/Script-7C0B24BE155310BE001AC942.sh
(1 failure)
忽略重新安装应用程序部分。那是来自应用程序代码。所以这告诉我它在运行时在某个时候崩溃了。单元测试在 Xcode 4 中运行得很好,我只是无法让它与命令行很好地配合。如果有任何帮助,我将 OCUnit 与 OCMock 一起使用。谢谢!