5

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 を使用しています。ありがとう!

4

1 に答える 1

0

最近、作業中のアプリケーションで同様の問題に遭遇しました。私はコードベースを継承しましたが、テストのセットアップがなかったので、それらを組み込む必要がありました。Apple のサンプル iPhoneTests プロジェクトに従ってプロジェクトをセットアップする標準的な方法を使用しようとしましたが、うまくいきませんでした。GHUnit に切り替えたところ、より簡単に作業できるようになりました。テストの作成にそれほど遠くない場合は、切り替えることをお勧めします。

ドキュメントは非常に優れており、コマンドラインとジェンキンスから実行するのに役立ちました。私のアプリでは、メイン ターゲットを複製し、ビルドに GHUnitiOS.framework を追加し、単体テスト クラスのソースを追加することで、テスト用の 2 番目のターゲットをセットアップしました。

お探しの回答ではないかもしれませんが、お役に立てば幸いです。

于 2012-06-06T15:24:15.120 に答える