Learning Android™ Application Programming: A Hands-On Guide to Building Android Applications
by James Talbot, Justin McLean, Jorge Hernandez
Running Tests from the Command Line
The first step in automating tests is to set them up so that they can run from the command line. This means that you can run them manually from the command line, but, more importantly, other tools can also run the tests for you.
To easily change the existing tests so that they can be run from the command line, you can use the adb utility.
1. Start a Jelly Bean emulator from the Android Virtual Device Manager. Start a command prompt, and check that you have an emulator running by using the adb devices command:
List of devices attachedemulator-5554 device
2. Type the following command to run the tests from the command line:
adb shell am instrument -w com.androiddevbook.onyourbike.chapter10.tests/android.test.InstrumentationTestRunner ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access