Skip Navigation

Execute specific tests from the command line with 

Follow these instructions to build the application, resolve dependencies, run the tests in the specified class on a connected 
 device, and record the results.
  1. Change the directory to samples/
  2. Run the following command: 
    ./gradlew connectedAppTestDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=<className>
     with the name of your class.
You can also run a specific test manually using the following method:
  1. Use 
     to build the 
  2. Use the 
     Debug Bridge (ADB) tool to install the app from the resulting .apk file. You can choose to uninstall any existing app first or to install as an upgrade.
  3. Execute specific test suites or individual tests using the ADB tool, with a command such as: 
    adb shell am instrument -w -e debug false -e class <packageName>.<className> <packageName>.test/testRunner
     with values for your app and class.
Test results are written to the following sub-directory: 
You can save test results using a continuous integration system. You can also use a JUnit plug-in to display the test results in a readable form, to send email messages to project members, or to take other common continuous integration actions.
For more information about running tests using the command line, see Android Studio: Test from the command line.