Running Instrumentation Tests from existing APKs

Stay organized with collections Save and categorize content based on your preferences.

These instructions assume you have the Trade Federation package available locally; if not, follow the download instructions to obtain it.

Then use the following command to install the APK of instrumentation tests, execute the tests, and display the tests that are running:

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

With output resembling:

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

You can optionally specify --serial <device serial number> to run against a given device. The serial number of your device can be otained using adb devices.

See the Testing through Tradefed section for more details about Tradefed executions.