gpt4 book ai didi

objective-c - 在命令行(OCUnit + OCMock)上运行 iOS 单元测试

转载 作者:太空狗 更新时间:2023-10-30 03:55:25 26 4
gpt4 key购买 nike

我正在尝试让单元测试在 CI (Jenkins) 中运行。我遇到了这个 a article在线使用一些 hack 来让测试在命令行中运行。我在一个具有单元测试默认设置的空项目上进行了尝试,那里的说明工作得很好,但是当我尝试在一个具有单元测试设置的现有项目上进行操作时,我遇到了一个不明确的错误:

/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 一起使用。谢谢!

最佳答案

我最近在处理一个应用程序时遇到了类似的问题。我继承了代码库,它没有测试设置,所以我不得不构建它们。我曾尝试使用 Apple 的标准方法根据他们的示例 iPhoneTests 项目设置项目,但它没有用。我切换到 GHUnit 并且能够更轻松地工作。如果您不太擅长编写测试,我建议您切换。

docs真的很好,可以让我从命令行和 Jenkins 运行。在我的应用程序中,我通过复制主要目标、将 GHUnitiOS.framework 添加到构建并为我的单元测试类添加其他源来设置第二个测试目标。

我知道这可能不是您要找的答案,但希望对您有所帮助!

关于objective-c - 在命令行(OCUnit + OCMock)上运行 iOS 单元测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10559404/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com