# AndroidJUnitRunner

Summary:[Inherited Constants](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#inhconstants)\|[Ctors](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#pubctors)\|[Methods](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#)  

# AndroidJUnitRunner

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


class
AndroidJUnitRunner
`  
`


``


``


``

extends `[MonitoringInstrumentation](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation)`


``


implements

OrchestratedInstrumentationListener.OnConnectListener


`

|---|---|---|---|------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||||
| ↳ | [android.app.Instrumentation](https://developer.android.com/reference/android/app/Instrumentation.html) ||||
|   | ↳ | android.support.test.internal.runner.hidden.ExposedInstrumentationApi |||
|   |   | ↳ | [android.support.test.runner.MonitoringInstrumentation](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation) ||
|   |   |   | ↳ | android.support.test.runner.AndroidJUnitRunner |

<br />

*** ** * ** ***

An[Instrumentation](https://developer.android.com/reference/android/app/Instrumentation.html)that runs JUnit3 and JUnit4 tests against an Android package (application).

Based on and replacement for[InstrumentationTestRunner](https://developer.android.com/reference/android/test/InstrumentationTestRunner.html). Supports a superset of[InstrumentationTestRunner](https://developer.android.com/reference/android/test/InstrumentationTestRunner.html)features, while maintaining command/output format compatibility with that class.

### Typical Usage

Write JUnit3 style[TestCase](https://developer.android.com/reference/junit/framework/TestCase.html)s and/or JUnit4 style[`Test`](http://junit.org/javadoc/latest/org/junit/Test.html)s that perform tests against the classes in your package. Make use of the[InstrumentationRegistry](https://developer.android.com/reference/android/support/test/InstrumentationRegistry)if needed.

In an appropriate AndroidManifest.xml, define an instrumentation with android:name set to[AndroidJUnitRunner](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner)and the appropriate android:targetPackage set.

<br />

#### Execution options:

**Running all tests:**adb shell am instrument -w com.android.foo/android.support.test.runner.AndroidJUnitRunner

**Running all tests in a class:**adb shell am instrument -w -e class com.android.foo.FooTest com.android.foo/android.support.test.runner.AndroidJUnitRunner

**Running a single test:**adb shell am instrument -w -e class com.android.foo.FooTest#testFoo com.android.foo/android.support.test.runner.AndroidJUnitRunner

**Running all tests in multiple classes:**adb shell am instrument -w -e class com.android.foo.FooTest,com.android.foo.TooTest com.android.foo/android.support.test.runner.AndroidJUnitRunner

**Running all tests except those in a particular class:**adb shell am instrument -w -e notClass com.android.foo.FooTest com.android.foo/android.support.test.runner.AndroidJUnitRunner

**Running all but a single test:**adb shell am instrument -w -e notClass com.android.foo.FooTest#testFoo com.android.foo/android.support.test.runner.AndroidJUnitRunner

**Running all tests listed in a file:**adb shell am instrument -w -e testFile /sdcard/tmp/testFile.txt com.android.foo/com.android.test.runner.AndroidJUnitRunner The file should contain a list of line separated package names or test classes and optionally methods. Valid package names consist of one or more java identifiers delimited by the '.' character, in which the first character of the last identifier is not a capitalized letter. Valid class names consist of one or more java identifiers delimited by the '.' character, in which the first character of the last identifier is a capitalized letter. Valid method names are valid class names with a '#' character and an additional java identifier appended to the end. (expected class format: com.android.foo.FooClassName#testMethodName) (expected package format: com.android.foo)

**Running all tests not listed in a file:**adb shell am instrument -w -e notTestFile /sdcard/tmp/notTestFile.txt com.android.foo/com.android.test.runner.AndroidJUnitRunner The file should contain a list of line separated package names or test classes and optionally methods. Valid package names consist of one or more java identifiers delimited by the '.' character, in which the first character of the last identifier is not a capitalized letter. Valid class names consist of one or more java identifiers delimited by the '.' character, in which the first character of the last identifier is a capitalized letter. Valid method names are valid class names with a '#' character and an additional java identifier appended to the end. (expected class format: com.android.foo.FooClassName#testMethodName) (expected package format: com.android.foo)

**Running all tests in a java package:**adb shell am instrument -w -e package com.android.foo.bar com.android.foo/android.support.test.runner.AndroidJUnitRunner

**Running all tests except a particular package:**adb shell am instrument -w -e notPackage com.android.foo.bar com.android.foo/android.support.test.runner.AndroidJUnitRunner

**To debug your tests, set a break point in your code and pass:**-e debug true

**Running a specific test size i.e. annotated with[SmallTest](https://developer.android.com/reference/android/support/test/filters/SmallTest)or[MediumTest](https://developer.android.com/reference/android/support/test/filters/MediumTest)or[LargeTest](https://developer.android.com/reference/android/support/test/filters/LargeTest):**adb shell am instrument -w -e size \[small\|medium\|large\] com.android.foo/android.support.test.runner.AndroidJUnitRunner

**Filter test run to tests with given annotation:**adb shell am instrument -w -e annotation com.android.foo.MyAnnotation com.android.foo/android.support.test.runner.AndroidJUnitRunner

If used with other options, the resulting test run will contain the intersection of the two options. e.g. "-e size large -e annotation com.android.foo.MyAnnotation" will run only tests with both the[LargeTest](https://developer.android.com/reference/android/support/test/filters/LargeTest)and "com.android.foo.MyAnnotation" annotations.

**Filter test run to tests*without*given annotation:**adb shell am instrument -w -e notAnnotation com.android.foo.MyAnnotation com.android.foo/android.support.test.runner.AndroidJUnitRunner

As above, if used with other options, the resulting test run will contain the intersection of the two options. e.g. "-e size large -e notAnnotation com.android.foo.MyAnnotation" will run tests with the[LargeTest](https://developer.android.com/reference/android/support/test/filters/LargeTest)annotation that do NOT have the "com.android.foo.MyAnnotation" annotations.

**Filter test run to tests*without any*of a list of annotations:**adb shell am instrument -w -e notAnnotation com.android.foo.MyAnnotation,com.android.foo.AnotherAnnotation com.android.foo/android.support.test.runner.AndroidJUnitRunner

**Filter test run to tests that pass all of a list of custom[filter(s)](https://developer.android.com/reference/org/junit/runner/manipulation/Filter):**adb shell am instrument -w -e filter com.android.foo.MyCustomFilter,com.android.foo.AnotherCustomFilter com.android.foo/android.support.test.runner.AndroidJUnitRunner

A[Filter](https://developer.android.com/reference/org/junit/runner/manipulation/Filter)class provided to the`filter`option must be public and must provide a public constructor of one of the following patterns. They are searched in order and the first one found is the one that is used.

1. `<init>()`- a no arguments constructor. This is for filters whose behavior is hard coded.
2. `<init>(Bundle bundle`- accepts a[Bundle](https://developer.android.com/reference/android/os/Bundle.html)that contains the options passed to this instance. This is for filters whose behavior needs to be configured through additional options to`am instrument`.

**Filter test run to a shard of all tests, where numShards is an integer greater than 0 and shardIndex is an integer between 0 (inclusive) and numShards (exclusive):**adb shell am instrument -w -e numShards 4 -e shardIndex 1 com.android.foo/android.support.test.runner.AndroidJUnitRunner

**Use custom[builders](https://developer.android.com/reference/org/junit/runners/model/RunnerBuilder)to run test classes:**adb shell am instrument -w -e runnerBuilder com.android.foo.MyCustomBuilder,com.android.foo.AnotherCustomBuilder com.android.foo/android.support.test.runner.AndroidJUnitRunner

A[RunnerBuilder](https://developer.android.com/reference/org/junit/runners/model/RunnerBuilder)class provided to the`runnerBuilder`option must be public and must provide a public no-argument constructor.

**To run in 'log only' mode**-e log true This option will load and iterate through all test classes and methods, but will bypass actual test execution. Useful for quickly obtaining info on the tests to be executed by an instrumentation command.

**To generate code coverage files (\*.ec) that can be used by EMMA or JaCoCo:** -e coverage true Note: For this to work, your classes have to be instrumented offline (i.e. at build time) by EMMA/JaCoCo. By default, the code coverage results file will be saved in a /data/data//files/coverage.ec file, unless overridden by coverageFile flag (see below)

**To specify EMMA or JaCoCo code coverage results file path:**-e coverage true -e coverageFile /sdcard/myFile.ec

**To specify one or more[`
RunListener`](http://junit.org/javadoc/latest/org/junit/runner/notification/RunListener.html)s to observe the test run:**-e listener com.foo.Listener,com.foo.Listener2

**To use the new order of[`
RunListener`](http://junit.org/javadoc/latest/org/junit/runner/notification/RunListener.html)s during a test run:**-e newRunListenerMode true

New order of listeners guarantee that user defined[`
RunListener`](http://junit.org/javadoc/latest/org/junit/runner/notification/RunListener.html)s will be running before any of the default listeners defined in this runner. Legacy order had those user defined listeners running after the default ones.

Note:The new order will become the default in the future.

**To specify a custom[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)to load the test class:**-e classLoader com.foo.CustomClassLoader

**Set timeout (in milliseconds) that will be applied to each test:**-e timeout_msec 5000

Supported for both JUnit3 and JUnit4 style tests. For JUnit3 tests, this flag is the only way to specify timeouts. For JUnit4 tests, this flag overrides timeouts specified via[`org.junit.rules.Timeout
`](http://junit.org/javadoc/latest/org/junit/rules/Timeout.html). Please note that in JUnit4[`
org.junit.Test#timeout()`](http://junit.org/javadoc/latest/org/junit/Test.html#timeout())annotation will take precedence over both, this flag and[`org.junit.rules.Timeout
`](http://junit.org/javadoc/latest/org/junit/rules/Timeout.html)rule.

**To disable Google Analytics:**-e disableAnalytics true

In order to make sure we are on the right track with each new release, the test runner collects analytics. More specifically, it uploads a hash of the package name of the application under test for each invocation. This allows us to measure both the count of unique packages using this library as well as the volume of usage.

**(Beta)To specify a custom[ScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCaptureProcessor)to use when processing a[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)produced by[capture()](https://developer.android.com/reference/android/support/test/runner/screenshot/Screenshot#capture())**: -e screenCaptureProcessors com.foo.Processor,com.foo.Processor2

If no[ScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCaptureProcessor)is provided then the[BasicScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/BasicScreenCaptureProcessor)is used. If one or more are provided the[BasicScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/BasicScreenCaptureProcessor)is not used unless it is one of the ones provided.

**(Beta) To specify a remote static method for the runner to attempt to call reflectively:**adb shell am instrument -w -e remoteMethod com.foo.bar#init

**Note:**The method must be static. Usually used to initiate a remote testing client that depends on the runner (e.g. Espresso).

**All arguments can also be specified in the in the AndroidManifest via a meta-data tag:**

eg. using listeners:  

    <instrumentation
        android:name="android.support.test.runner.AndroidJUnitRunner"
        android:targetPackage="com.foo.Bar">
        <meta-data
            android:name="listener"
            android:value="com.foo.Listener,com.foo.Listener2" />
     </instrumentation>
     
Arguments specified via shell will override manifest specified arguments.

<br />

## Summary

|                                                                                                                                                                                                                                                                       ### Inherited constants                                                                                                                                                                                                                                                                       |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#)From class` android.app.Instrumentation ` |-------------------------------------------------------------------------|----------------------------------| | [String](https://developer.android.com/reference/java/lang/String.html) | `REPORT_KEY_IDENTIFIER` <br />   | | [String](https://developer.android.com/reference/java/lang/String.html) | `REPORT_KEY_STREAMRESULT` <br /> | |

|                                                           ### Public constructors                                                            ||
|-------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[AndroidJUnitRunner](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#AndroidJUnitRunner())`() ` |

|                                                                                                                                                                      ### Public methods                                                                                                                                                                      ||
|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`    | ` `[finish](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#finish(int, android.os.Bundle))`(int resultCode, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` results) ` Ensures all activities launched in this instrumentation are finished before the instrumentation exits. |
| ` void`    | ` `[onCreate](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#onCreate(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arguments) ` Sets up lifecycle monitoring, and argument registry.                                                                  |
| ` boolean` | ` `[onException](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#onException(java.lang.Object, java.lang.Throwable))`(`[Object](https://developer.android.com/reference/java/lang/Object.html)` obj, `[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)` e) `                 |
| ` void`    | ` `[onStart](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#onStart())`() ` This implementation of onStart() will guarantee that the Application's onCreate method has completed when it returns.                                                                                                        |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#)From class` `[android.support.test.runner.MonitoringInstrumentation](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation)` ` |------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` void`                                                                                                                      | ` `[callActivityOnCreate](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnCreate(android.app.Activity, android.os.Bundle))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` bundle) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` void`                                                                                                                      | ` `[callActivityOnDestroy](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnDestroy(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                                                      | ` `[callActivityOnPause](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnPause(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                      | ` `[callActivityOnRestart](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnRestart(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                                                      | ` `[callActivityOnResume](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnResume(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` void`                                                                                                                      | ` `[callActivityOnStart](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnStart(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                      | ` `[callActivityOnStop](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnStop(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                                                      | ` `[callApplicationOnCreate](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callApplicationOnCreate(android.app.Application))`(`[Application](https://developer.android.com/reference/android/app/Application.html)` app) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                      | ` `[dumpThreadStateToOutputs](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#dumpThreadStateToOutputs(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` outputFileName) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` void`                                                                                                                      | ` `[execStartActivities](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivities(android.content.Context, android.os.IBinder, android.os.IBinder, android.app.Activity, android.content.Intent[], android.os.Bundle))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` target, `[Intent[]](https://developer.android.com/reference/android/content/Intent.html)` intents, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` options) ` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[execStartActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivity(android.content.Context, android.os.IBinder, android.os.IBinder, android.app.Fragment, android.content.Intent, int, android.os.Bundle))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Fragment](https://developer.android.com/reference/android/app/Fragment.html)` target, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, int requestCode, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` options) ` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[execStartActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivity(android.content.Context, android.os.IBinder, android.os.IBinder, android.app.Activity, android.content.Intent, int, android.os.Bundle))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` target, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, int requestCode, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` options) ` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[execStartActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivity(android.content.Context, android.os.IBinder, android.os.IBinder, android.app.Activity, android.content.Intent, int, android.os.Bundle, android.os.UserHandle))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` target, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, int requestCode, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` options, `[UserHandle](https://developer.android.com/reference/android/os/UserHandle.html)` user) ` This API was added in Android API 17 (JELLY_BEAN_MR1)                                                                                                                                                                                                                                                                                             | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[execStartActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivity(android.content.Context, android.os.IBinder, android.os.IBinder, android.app.Activity, android.content.Intent, int))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` target, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, int requestCode) ` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[execStartActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivity(android.content.Context, android.os.IBinder, android.os.IBinder, java.lang.String, android.content.Intent, int, android.os.Bundle))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[String](https://developer.android.com/reference/java/lang/String.html)` target, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, int requestCode, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` options) ` This API was added in Android API 23 (M)                                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                                                      | ` `[finish](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#finish(int, android.os.Bundle))`(int resultCode, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` results) ` Ensures all activities launched in this instrumentation are finished before the instrumentation exits.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String.html)                                                   | ` `[getThreadState](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#getThreadState())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                      | ` `[installMultidex](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#installMultidex())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                      | ` `[installOldMultiDex](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#installOldMultiDex(java.lang.Class<?>))`(`[Class](https://developer.android.com/reference/java/lang/Class.html)`<?> multidexClass) ` Perform application MultiDex installation only when instrumentation installation is not available.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                                                      | ` `[interceptActivityUsing](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#interceptActivityUsing(android.support.test.runner.intercepting.InterceptingActivityFactory))`(`[InterceptingActivityFactory](https://developer.android.com/reference/android/support/test/runner/intercepting/InterceptingActivityFactory)` interceptingActivityFactory) ` Use the given InterceptingActivityFactory to create Activity instance in[newActivity(ClassLoader, String, Intent)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent)).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ` boolean`                                                                                                                   | ` `[isPrimaryInstrProcess](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#isPrimaryInstrProcess(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` argsProcessName) ` Checks whether this instance of instrumentation should be considered as a primary instrumentation process.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                             | ` `[newActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#newActivity(java.lang.Class<?>, android.content.Context, android.os.IBinder, android.app.Application, android.content.Intent, android.content.pm.ActivityInfo, java.lang.CharSequence, android.app.Activity, java.lang.String, java.lang.Object))`(`[Class](https://developer.android.com/reference/java/lang/Class.html)`<?> clazz, `[Context](https://developer.android.com/reference/android/content/Context.html)` context, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Application](https://developer.android.com/reference/android/app/Application.html)` application, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, `[ActivityInfo](https://developer.android.com/reference/android/content/pm/ActivityInfo.html)` info, `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence.html)` title, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` parent, `[String](https://developer.android.com/reference/java/lang/String.html)` id, `[Object](https://developer.android.com/reference/java/lang/Object.html)` lastNonConfigurationInstance) ` | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                             | ` `[newActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent))`(`[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)` cl, `[String](https://developer.android.com/reference/java/lang/String.html)` className, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` void`                                                                                                                      | ` `[onCreate](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#onCreate(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arguments) ` Sets up lifecycle monitoring, and argument registry.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` void`                                                                                                                      | ` `[onDestroy](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#onDestroy())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` boolean`                                                                                                                   | ` `[onException](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#onException(java.lang.Object, java.lang.Throwable))`(`[Object](https://developer.android.com/reference/java/lang/Object.html)` obj, `[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)` e) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` void`                                                                                                                      | ` `[onStart](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#onStart())`() ` This implementation of onStart() will guarantee that the Application's onCreate method has completed when it returns.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` final void`                                                                                                                | ` `[setJsBridgeClassName](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#setJsBridgeClassName(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` className) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` void`                                                                                                                      | ` `[specifyDexMakerCacheProperty](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#specifyDexMakerCacheProperty())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                             | ` `[startActivitySync](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#startActivitySync(android.content.Intent))`(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                      | ` `[useDefaultInterceptingActivityFactory](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#useDefaultInterceptingActivityFactory())`() ` Use default mechanism of creating activity instance in[newActivity(ClassLoader, String, Intent)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | ` void`                                                                                                                      | ` `[waitForActivitiesToComplete](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#waitForActivitiesToComplete())`() ` Ensures we've onStopped() all activities which were onStarted().                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#)From class` android.support.test.internal.runner.hidden.ExposedInstrumentationApi ` |------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` void`                                                                                                                      | ` execStartActivities(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg3, `[Intent[]](https://developer.android.com/reference/android/content/Intent.html)` arg4, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg5) `                                                                                                | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` execStartActivity(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, int arg5) `                                                                                                                                                                           | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` execStartActivity(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Fragment](https://developer.android.com/reference/android/app/Fragment.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, int arg5, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg6) `                                                                                          | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` execStartActivity(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[String](https://developer.android.com/reference/java/lang/String.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, int arg5, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg6) `                                                                                                | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` execStartActivity(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, int arg5, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg6) `                                                                                          | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` execStartActivity(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, int arg5, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg6, `[UserHandle](https://developer.android.com/reference/android/os/UserHandle.html)` arg7) ` | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#)From class` `[android.app.Instrumentation](https://developer.android.com/reference/android/app/Instrumentation.html)` ` |--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` TestLooperManager`                                                                                                           | ` acquireLooperManager(`[Looper](https://developer.android.com/reference/android/os/Looper.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` `[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html) | ` addMonitor(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html)` arg1, boolean arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` `[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html) | ` addMonitor(`[IntentFilter](https://developer.android.com/reference/android/content/IntentFilter.html)` arg0, `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html)` arg1, boolean arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` void`                                                                                                                        | ` addMonitor(`[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                                                        | ` addResults(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` callActivityOnCreate(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` callActivityOnCreate(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1, `[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                        | ` callActivityOnDestroy(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` callActivityOnNewIntent(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                                                        | ` callActivityOnPause(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                        | ` callActivityOnPostCreate(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1, `[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ` void`                                                                                                                        | ` callActivityOnPostCreate(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                        | ` callActivityOnRestart(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` callActivityOnRestoreInstanceState(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                        | ` callActivityOnRestoreInstanceState(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1, `[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` void`                                                                                                                        | ` callActivityOnResume(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` void`                                                                                                                        | ` callActivityOnSaveInstanceState(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1, `[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                                                        | ` callActivityOnSaveInstanceState(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ` void`                                                                                                                        | ` callActivityOnStart(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                        | ` callActivityOnStop(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` void`                                                                                                                        | ` callActivityOnUserLeaving(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                        | ` callApplicationOnCreate(`[Application](https://developer.android.com/reference/android/app/Application.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` boolean`                                                                                                                     | ` checkMonitorHit(`[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html)` arg0, int arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                                                        | ` endPerformanceSnapshot() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` void`                                                                                                                        | ` finish(int arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                    | ` getAllocCounts() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                    | ` getBinderCounts() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` `[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)                                 | ` getComponentName() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` `[Context](https://developer.android.com/reference/android/content/Context.html)                                             | ` getContext() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` `[String](https://developer.android.com/reference/java/lang/String.html)                                                     | ` getProcessName() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` `[Context](https://developer.android.com/reference/android/content/Context.html)                                             | ` getTargetContext() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` `[UiAutomation](https://developer.android.com/reference/android/app/UiAutomation.html)                                       | ` getUiAutomation(int arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` `[UiAutomation](https://developer.android.com/reference/android/app/UiAutomation.html)                                       | ` getUiAutomation() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` boolean`                                                                                                                     | ` invokeContextMenuAction(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, int arg1, int arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` boolean`                                                                                                                     | ` invokeMenuActionSync(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, int arg1, int arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` boolean`                                                                                                                     | ` isProfiling() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` newActivity(`[Class](https://developer.android.com/reference/java/lang/Class.html)`<?> arg0, `[Context](https://developer.android.com/reference/android/content/Context.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Application](https://developer.android.com/reference/android/app/Application.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, `[ActivityInfo](https://developer.android.com/reference/android/content/pm/ActivityInfo.html)` arg5, `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence.html)` arg6, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg7, `[String](https://developer.android.com/reference/java/lang/String.html)` arg8, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg9) ` | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` newActivity(`[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)` arg0, `[String](https://developer.android.com/reference/java/lang/String.html)` arg1, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` `[Application](https://developer.android.com/reference/android/app/Application.html)                                         | ` newApplication(`[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)` arg0, `[String](https://developer.android.com/reference/java/lang/String.html)` arg1, `[Context](https://developer.android.com/reference/android/content/Context.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` static `[Application](https://developer.android.com/reference/android/app/Application.html)                                  | ` newApplication(`[Class](https://developer.android.com/reference/java/lang/Class.html)`<?> arg0, `[Context](https://developer.android.com/reference/android/content/Context.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` void`                                                                                                                        | ` onCreate(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                        | ` onDestroy() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` boolean`                                                                                                                     | ` onException(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0, `[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` void`                                                                                                                        | ` onStart() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                        | ` removeMonitor(`[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` void`                                                                                                                        | ` runOnMainSync(`[Runnable](https://developer.android.com/reference/java/lang/Runnable.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` void`                                                                                                                        | ` sendCharacterSync(int arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` sendKeyDownUpSync(int arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` sendKeySync(`[KeyEvent](https://developer.android.com/reference/android/view/KeyEvent.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                        | ` sendPointerSync(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` void`                                                                                                                        | ` sendStatus(int arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` void`                                                                                                                        | ` sendStringSync(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                                                        | ` sendTrackballEventSync(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                                                        | ` setAutomaticPerformanceSnapshots() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                        | ` setInTouchMode(boolean arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` void`                                                                                                                        | ` start() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` startActivitySync(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` startActivitySync(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` void`                                                                                                                        | ` startAllocCounting() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | ` void`                                                                                                                        | ` startPerformanceSnapshot() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` void`                                                                                                                        | ` startProfiling() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` void`                                                                                                                        | ` stopAllocCounting() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                                                        | ` stopProfiling() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                        | ` waitForIdle(`[Runnable](https://developer.android.com/reference/java/lang/Runnable.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                        | ` waitForIdleSync() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` waitForMonitor(`[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` waitForMonitorWithTimeout(`[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html)` arg0, long arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                                | | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                             | ` finalize() `                                                                             | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner#)From interface` android.support.test.orchestrator.instrumentationlistener.OrchestratedInstrumentationListener.OnConnectListener ` |------------------|-----------------------------| | ` abstract void` | ` onOrchestratorConnect() ` | ||

## Public constructors

### AndroidJUnitRunner

```
AndroidJUnitRunner ()
```

<br />

<br />

## Public methods

### finish

```
void finish (int resultCode, 
                Bundle results)
```

Ensures all activities launched in this instrumentation are finished before the instrumentation exits.

Subclasses who override this method should do their finish processing and then call super.finish to invoke this logic. Not waiting for all activities to finish() before exiting can cause device wide instability.

<br />

|          Parameters           ||
|--------------|-----------------|
| `resultCode` | `int` <br />    |
| `results`    | `Bundle` <br /> |

### onCreate

```
void onCreate (Bundle arguments)
```

Sets up lifecycle monitoring, and argument registry.

Subclasses must call up to onCreate(). This onCreate method does not call start() it is the subclasses responsibility to call start if it desires.

<br />

|          Parameters          ||
|-------------|-----------------|
| `arguments` | `Bundle` <br /> |

### onException

```
boolean onException (Object obj, 
                Throwable e)
```

<br />

<br />

|        Parameters         ||
|-------|--------------------|
| `obj` | `Object` <br />    |
| `e`   | `Throwable` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### onStart

```
void onStart ()
```

This implementation of onStart() will guarantee that the Application's onCreate method has completed when it returns.

Subclasses should call super.onStart() before executing any code that touches the application and it's state.

<br />

-

  ## Classes

  - [AndroidJUnit4](https://developer.android.com/reference/android/support/test/runner/AndroidJUnit4)
  - [AndroidJUnitRunner](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner)
  - [MonitoringInstrumentation](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation)
  - [MonitoringInstrumentation.ActivityFinisher](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation.ActivityFinisher)
  - [UsageTrackerFacilitator](https://developer.android.com/reference/android/support/test/runner/UsageTrackerFacilitator)