Exécuter des tests d'instrumentation à partir d'APK existants

Ces instructions supposent que vous disposez du package Trade Federation en local . Si ce n'est pas le cas, suivez les instructions de téléchargement pour l'obtenir.

Utilisez ensuite la commande suivante pour installer l'APK des tests d'instrumentation, exécuter les tests et afficher ceux qui sont en cours d'exécution :

./tradefed.sh run instrumentations --apk-path <path of your apk>

Avec un résultat semblable à celui-ci :

07-17 10:55:32 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testOfArgb
07-17 10:55:33 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testIsRunning
07-17 10:55:34 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testGetCurrentPlayTime
07-17 10:55:35 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testStartDelay
07-17 10:55:35 I/InvocationToJUnitResultForwarder: Run ended in 2m 20s

Vous pouvez éventuellement spécifier --serial <device serial number> pour exécuter sur un appareil donné. Vous pouvez obtenir le numéro de série de votre appareil à l'aide de adb devices.

Pour en savoir plus sur les exécutions Tradefed, consultez la section Tests via Tradefed.