2012-05-11 9 views
5

Sto cercando di eseguire i test delle unità in CI (Jenkins). Mi sono imbattuto in questo a article online con alcuni hack per ottenere test eseguiti in linea di comando. L'ho provato su un progetto vuoto con l'impostazione predefinita per i test unitari e le istruzioni funzionano bene, ma quando provo a farlo su un progetto esistente che ha setup unità di test sto ricevendo un errore ambiguo:Problema di esecuzione dei test dell'unità iOS sulla riga di comando (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) 

Ignora la parte dell'app di resinstall. Questo è dal codice dell'app. Quindi questo mi dice che è andato in crash durante il runtime ad un certo punto. I test di unità funzionano perfettamente con Xcode 4, non riesco a farlo funzionare bene con la riga di comando. Se è di aiuto, sto usando OCUnit con OCMock. Grazie!

+0

Hai mai trovato una soluzione per questo? Ho lo stesso problema. Cercando di eseguire i test Cedar dalla riga di comando e ottengo lo stesso errore "Impossibile creare il file; codice = 2" – AFraser

+0

Purtroppo non ho mai trovato una soluzione per questo. Ho finito per cambiare i test (in precedenza test delle applicazioni) in test di unità logica e hanno funzionato bene. –

risposta

0

Recentemente ho riscontrato problemi simili con un'applicazione su cui sto lavorando. Ho ereditato il codebase e non ha avuto setup di test, quindi ho dovuto costruirli. Avevo provato ad utilizzare il modo standard Apple di configurare il progetto in base al loro progetto iPhoneTests di esempio, ma non ha funzionato. Sono passato a GHUnit e sono riuscito a farlo funzionare in modo più semplice. Se non sei troppo lontano a scrivere i test, ti suggerirei di cambiare.

I docs sono veramente buoni e hanno funzionato per me per eseguire da riga di comando e Jenkins. Nella mia app ho impostato un secondo obiettivo per i test duplicando il target principale, aggiungendo GHUnitiOS.framework alla build e aggiungendo ulteriori fonti per le mie classi di test dell'unità.

So che potrebbe non essere la risposta che stai cercando, ma spero che sia d'aiuto!