Objective c 在命令行上运行iOS单元测试的问题(OCUnit和OCMock)

Objective c 在命令行上运行iOS单元测试的问题(OCUnit和OCMock),objective-c,unit-testing,ocunit,ocmock,Objective C,Unit Testing,Ocunit,Ocmock,我试图让单元测试在CI中运行(Jenkins)。我是在网上遇到这个问题的,当时有一些黑客在命令行中运行测试。我在一个空项目上尝试了它,该项目具有单元测试的默认设置,并且那里的说明工作得很好,但是当我在一个具有单元测试设置的现有项目上尝试这样做时,我得到了一个不明确的错误: /bin/sh -c /Users/jzhwu/smule/magicpiano/build/MagicPiano.build/Debug-iphonesimulator/MagicPianoTest.build/Script

我试图让单元测试在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)

忽略resinstall应用程序部分。这是应用程序代码。这告诉我它在运行时的某个时刻崩溃了。单元测试在Xcode 4中运行得很好,我就是不能让它在命令行中运行得很好。如果有什么帮助的话,我将OCUnit与OCMock一起使用。谢谢

我最近在开发一个应用程序时遇到了类似的问题。我继承了代码库,它没有测试设置,所以我必须在中构建这些测试。我曾尝试过使用苹果公司的标准方式,根据他们的iPhoneTests示例项目来设置项目,但没有成功。我切换到GHUnit,使它工作起来更容易。如果你在写测试方面做得不太好,我建议你换一下

这些都非常好,对我来说从命令行和詹金斯那里运行非常有效。 在我的应用程序中,我通过复制主目标设置了第二个测试目标,将GHUnitiOS.framework添加到构建中,并为我的单元测试类添加了其他源


我知道这可能不是你想要的答案,但我希望它能帮助你

你有没有找到解决办法?我也有同样的问题。尝试从命令行运行Cedar测试时,我得到相同的“未能创建文件;代码=2”错误。不幸的是,我从未找到解决此问题的方法。我最终将测试(以前的应用程序测试)更改为逻辑单元测试,它们运行良好。