2012-05-11 2 views
5

CI (Jenkins)에서 실행되는 단위 테스트를 얻으려고합니다. 나는 명령 줄에서 테스트를 실행하기 위해 몇 가지 해킹으로이 온라인 a article을 발견했다. 내가 단위 테스트에 대한 기본 설정과 거기에 지침을 잘 작동하지만, 빈 프로젝트에서 그것을 시도한 유닛 테스트 설정이있는 기존 프로젝트에서 할 때 난 모호한 오류가있어 :명령 줄에서 iOS 단위 테스트 실행 문제 (OCUnit + OCMock)

/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에서 정상적으로 실행됩니다. 단지 명령 행으로 훌륭하게 재생할 수 없습니다. 도움이된다면 OCMock과 함께 OCUnit을 사용하고 있습니다. 감사!

+0

당신은 이것을위한 해결책을 찾았습니까? 나는 같은 문제를 가지고있다. 명령 줄에서 Cedar 테스트를 실행하려고하면 "파일을 만들지 못했습니다. 코드 = 2"오류가 발생합니다. – AFraser

+0

불행히도이 문제에 대한 해결책을 찾지 못했습니다. 필자는 테스트 (이전의 응용 프로그램 테스트)를 논리적 단위 테스트로 변경하여 정상적으로 실행되었습니다. –

답변

0

최근 작업중인 응용 프로그램과 비슷한 문제가 발생했습니다. 나는 코드베이스를 상속 받았으며 테스트를 설정하지 않았으므로 그 코드를 빌드해야했습니다. Apple의 표준 iPhoneTests 프로젝트에 따라 프로젝트를 설정하는 방법을 사용하려했지만 작동하지 않았습니다. 나는 GHUnit으로 바꾸었고 나는 그것을 더 쉽게 작동시킬 수 있었다. 테스트를 작성하는 데 그리 멀지 않은 경우 전환을 제안합니다.

docs은 정말 훌륭하고 커맨드 라인과 젠킨스에서 실행하기에 적합했습니다. 내 응용 프로그램에서 기본 대상을 복제하고 빌드에 GHUnitiOS.framework를 추가하고 단위 테스트 클래스에 대한 추가 소스를 추가하여 테스트 할 두 번째 대상을 설정했습니다.

나는 그것이 당신이 찾고있는 해답이 아닐 수도 있지만 도움이되기를 바랍니다!