2012-05-11 25 views
5

Estoy tratando de obtener pruebas unitarias para que se ejecuten en CI (Jenkins). Encontré este a article en línea con algunos hacks para ejecutar pruebas en línea de comandos. Lo probé en un proyecto vacío con la configuración predeterminada para pruebas unitarias y las instrucciones funcionan bien, pero cuando trato de hacerlo en un proyecto existente que tiene configuración de pruebas unitarias recibo un error ambiguo:Problema al ejecutar pruebas de la unidad iOS en la línea de comandos (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) 

Ignore la parte de la aplicación de reinstalación. Eso es del código de la aplicación. Entonces esto me dice que se bloqueó durante el tiempo de ejecución en algún momento. Las pruebas de la unidad funcionan bien dentro de Xcode 4, simplemente no puedo hacer que funcione bien con la línea de comandos. Si es de alguna ayuda, estoy usando OCUnit con OCMock. ¡Gracias!

+0

¿Alguna vez encontró una solución para esto? Tengo el mismo problema. Intentando ejecutar pruebas de Cedar desde la línea de comandos y obtengo el mismo error "Error al crear archivo; código = 2" – AFraser

+0

Desafortunadamente, nunca encontré una solución para esto. Terminé cambiando las pruebas (anteriormente pruebas de aplicación) en pruebas de unidades lógicas y funcionaron bien. –

Respuesta

0

Me encontré con problemas similares recientemente con una aplicación en la que estoy trabajando. Heredé la base de código y no tenía ninguna configuración de pruebas, así que tuve que compilarlas. Había intentado utilizar la forma estándar de Apple de configurar el proyecto de acuerdo con su proyecto iPhoneTests de muestra, pero no funcionó. Cambié a GHUnit y pude hacerlo funcionar mucho más fácil. Si no estás muy avanzado escribiendo pruebas, te sugiero que cambies.

Los docs son realmente buenos y me funcionaron para ejecutar desde la línea de comandos y Jenkins. En mi aplicación he configurado un segundo objetivo para probar duplicando el objetivo principal, agregando GHUnitiOS.framework a la compilación y agregando fuentes adicionales para las clases de prueba de mi unidad.

Sé que puede que no sea la respuesta que está buscando pero espero que ayude!

Cuestiones relacionadas