# UiAutomatorTestCase

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

# UiAutomatorTestCase

| 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
UiAutomatorTestCase
`  
`


``


``


``

extends `[InstrumentationTestCase](https://developer.android.com/reference/android/test/InstrumentationTestCase.html)`


``


`

|---|---|---|---|------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||||
| ↳ | [junit.framework.Assert](https://developer.android.com/reference/junit/framework/Assert.html) ||||
|   | ↳ | [junit.framework.TestCase](https://developer.android.com/reference/junit/framework/TestCase.html) |||
|   |   | ↳ | [android.test.InstrumentationTestCase](https://developer.android.com/reference/android/test/InstrumentationTestCase.html) ||
|   |   |   | ↳ | android.support.test.uiautomator.UiAutomatorTestCase |

<br />

*** ** * ** ***

<br />

**This class is deprecated.**   
It is no longer necessary to extend UiAutomatorTestCase. You can use[getInstance(Instrumentation)](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice#getInstance(android.app.Instrumentation))from any test class as long as you have access to an[Instrumentation](https://developer.android.com/reference/android/app/Instrumentation.html)instance.

UI Automator test case that is executed on the device.

## Summary

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

|                                                                                                                                                                                                                   ### Public methods                                                                                                                                                                                                                    ||
|----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[IAutomationSupport](https://developer.android.com/reference/android/support/test/uiautomator/IAutomationSupport) | ` `[getAutomationSupport](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase#getAutomationSupport())`() ` *This method is deprecated. Use[sendStatus(int, Bundle)](https://developer.android.com/reference/android/app/Instrumentation.html#sendStatus(int, android.os.Bundle))instead* |
| ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                          | ` `[getParams](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase#getParams())`() ` Get command line parameters.                                                                                                                                                                        |
| ` `[UiDevice](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice)                     | ` `[getUiDevice](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase#getUiDevice())`() ` Get current instance of[UiDevice](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice).                                                                           |
| ` void`                                                                                                              | ` `[sleep](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase#sleep(long))`(long ms) ` *This method is deprecated. Use[sleep(long)](https://developer.android.com/reference/android/os/SystemClock.html#sleep(long))instead.*                                                           |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase#)From class` `[android.test.InstrumentationTestCase](https://developer.android.com/reference/android/test/InstrumentationTestCase.html)` ` |--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Instrumentation](https://developer.android.com/reference/android/app/Instrumentation.html)         | ` getInstrumentation() `                                                                                                                                                                                                                                                            | | ` void`                                                                                                | ` injectInsrumentation(`[Instrumentation](https://developer.android.com/reference/android/app/Instrumentation.html)` arg0) `                                                                                                                                                        | | ` void`                                                                                                | ` injectInstrumentation(`[Instrumentation](https://developer.android.com/reference/android/app/Instrumentation.html)` arg0) `                                                                                                                                                       | | ` final <T extends `[Activity](https://developer.android.com/reference/android/app/Activity.html)`> T` | ` launchActivity(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T> arg1, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg2) `                | | ` final <T extends `[Activity](https://developer.android.com/reference/android/app/Activity.html)`> T` | ` launchActivityWithIntent(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T> arg1, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg2) ` | | ` void`                                                                                                | ` runTest() `                                                                                                                                                                                                                                                                       | | ` void`                                                                                                | ` runTestOnUiThread(`[Runnable](https://developer.android.com/reference/java/lang/Runnable.html)` arg0) `                                                                                                                                                                           | | ` void`                                                                                                | ` sendKeys(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0) `                                                                                                                                                                                        | | ` void`                                                                                                | ` sendKeys(int... arg0) `                                                                                                                                                                                                                                                           | | ` void`                                                                                                | ` sendRepeatedKeys(int... arg0) `                                                                                                                                                                                                                                                   | | ` void`                                                                                                | ` tearDown() `                                                                                                                                                                                                                                                                      | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase#)From class` `[junit.framework.TestCase](https://developer.android.com/reference/junit/framework/TestCase.html)` ` |------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| | ` int`                                                                                   | ` countTestCases() `                                                                                  | | ` `[TestResult](https://developer.android.com/reference/junit/framework/TestResult.html) | ` createResult() `                                                                                    | | ` `[String](https://developer.android.com/reference/java/lang/String.html)               | ` getName() `                                                                                         | | ` `[TestResult](https://developer.android.com/reference/junit/framework/TestResult.html) | ` run() `                                                                                             | | ` void`                                                                                  | ` run(`[TestResult](https://developer.android.com/reference/junit/framework/TestResult.html)` arg0) ` | | ` void`                                                                                  | ` runBare() `                                                                                         | | ` void`                                                                                  | ` runTest() `                                                                                         | | ` void`                                                                                  | ` setName(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0) `           | | ` void`                                                                                  | ` setUp() `                                                                                           | | ` void`                                                                                  | ` tearDown() `                                                                                        | | ` `[String](https://developer.android.com/reference/java/lang/String.html)               | ` toString() `                                                                                        | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase#)From class` `[junit.framework.Assert](https://developer.android.com/reference/junit/framework/Assert.html)` ` |-----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` static void`                                                                    | ` assertEquals(boolean arg0, boolean arg1) `                                                                                                                                                                                                                      | | ` static void`                                                                    | ` assertEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, long arg1, long arg2) `                                                                                                                                            | | ` static void`                                                                    | ` assertEquals(short arg0, short arg1) `                                                                                                                                                                                                                          | | ` static void`                                                                    | ` assertEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[String](https://developer.android.com/reference/java/lang/String.html)` arg1, `[String](https://developer.android.com/reference/java/lang/String.html)` arg2) `  | | ` static void`                                                                    | ` assertEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, int arg1, int arg2) `                                                                                                                                              | | ` static void`                                                                    | ` assertEquals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg1) `                                                                                  | | ` static void`                                                                    | ` assertEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, boolean arg1, boolean arg2) `                                                                                                                                      | | ` static void`                                                                    | ` assertEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[String](https://developer.android.com/reference/java/lang/String.html)` arg1) `                                                                                  | | ` static void`                                                                    | ` assertEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, short arg1, short arg2) `                                                                                                                                          | | ` static void`                                                                    | ` assertEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg1, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg2) `  | | ` static void`                                                                    | ` assertEquals(char arg0, char arg1) `                                                                                                                                                                                                                            | | ` static void`                                                                    | ` assertEquals(byte arg0, byte arg1) `                                                                                                                                                                                                                            | | ` static void`                                                                    | ` assertEquals(double arg0, double arg1, double arg2) `                                                                                                                                                                                                           | | ` static void`                                                                    | ` assertEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, char arg1, char arg2) `                                                                                                                                            | | ` static void`                                                                    | ` assertEquals(float arg0, float arg1, float arg2) `                                                                                                                                                                                                              | | ` static void`                                                                    | ` assertEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, double arg1, double arg2, double arg3) `                                                                                                                           | | ` static void`                                                                    | ` assertEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, byte arg1, byte arg2) `                                                                                                                                            | | ` static void`                                                                    | ` assertEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, float arg1, float arg2, float arg3) `                                                                                                                              | | ` static void`                                                                    | ` assertEquals(long arg0, long arg1) `                                                                                                                                                                                                                            | | ` static void`                                                                    | ` assertEquals(int arg0, int arg1) `                                                                                                                                                                                                                              | | ` static void`                                                                    | ` assertFalse(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, boolean arg1) `                                                                                                                                                     | | ` static void`                                                                    | ` assertFalse(boolean arg0) `                                                                                                                                                                                                                                     | | ` static void`                                                                    | ` assertNotNull(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) `                                                                                                                                                                 | | ` static void`                                                                    | ` assertNotNull(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg1) `                                                                                 | | ` static void`                                                                    | ` assertNotSame(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg1, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg2) ` | | ` static void`                                                                    | ` assertNotSame(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg1) `                                                                                 | | ` static void`                                                                    | ` assertNull(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg1) `                                                                                    | | ` static void`                                                                    | ` assertNull(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) `                                                                                                                                                                    | | ` static void`                                                                    | ` assertSame(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg1, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg2) `    | | ` static void`                                                                    | ` assertSame(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg1) `                                                                                    | | ` static void`                                                                    | ` assertTrue(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, boolean arg1) `                                                                                                                                                      | | ` static void`                                                                    | ` assertTrue(boolean arg0) `                                                                                                                                                                                                                                      | | ` static void`                                                                    | ` fail(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0) `                                                                                                                                                                          | | ` static void`                                                                    | ` fail() `                                                                                                                                                                                                                                                        | | ` static void`                                                                    | ` failNotEquals(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg1, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg2) ` | | ` static void`                                                                    | ` failNotSame(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg1, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg2) `   | | ` static void`                                                                    | ` failSame(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0) `                                                                                                                                                                      | | ` static `[String](https://developer.android.com/reference/java/lang/String.html) | ` format(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg1, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg2) `        | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase#)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/uiautomator/UiAutomatorTestCase#)From interface` `[junit.framework.Test](https://developer.android.com/reference/junit/framework/Test.html)` ` |------------------|-------------------------------------------------------------------------------------------------------| | ` abstract int`  | ` countTestCases() `                                                                                  | | ` abstract void` | ` run(`[TestResult](https://developer.android.com/reference/junit/framework/TestResult.html)` arg0) ` | ||

## Public constructors

### UiAutomatorTestCase

```
UiAutomatorTestCase ()
```

<br />

<br />

## Public methods

### getAutomationSupport

```
IAutomationSupport getAutomationSupport ()
```

<br />

**This method is deprecated.**   
Use[sendStatus(int, Bundle)](https://developer.android.com/reference/android/app/Instrumentation.html#sendStatus(int, android.os.Bundle))instead

Provides support for running tests to report interim status

<br />

|                                                                   Returns                                                                    ||
|-------------------------------------------------------------------------------------------------------------------|---------------------------|
| [IAutomationSupport](https://developer.android.com/reference/android/support/test/uiautomator/IAutomationSupport) | IAutomationSupport <br /> |

### getParams

```
Bundle getParams ()
```

Get command line parameters. On the command line when passing`-e key value`pairs, the[Bundle](https://developer.android.com/reference/android/os/Bundle.html)will have the key value pairs conveniently available to the tests.

<br />

|                                     Returns                                      ||
|--------------------------------------------------------------------------|--------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html) | <br /> |

### getUiDevice

```
UiDevice getUiDevice ()
```

Get current instance of[UiDevice](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice). Works similar to calling the static[getInstance()](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice#getInstance())from anywhere in the test classes.

<br />

|                                                Returns                                                ||
|-----------------------------------------------------------------------------------------------|--------|
| [UiDevice](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice) | <br /> |

### sleep

```
void sleep (long ms)
```

<br />

**This method is deprecated.**   
Use[sleep(long)](https://developer.android.com/reference/android/os/SystemClock.html#sleep(long))instead.

Calls[sleep(long)](https://developer.android.com/reference/android/os/SystemClock.html#sleep(long))to sleep

<br />

|                Parameters                ||
|------|------------------------------------|
| `ms` | `long`: is in milliseconds. <br /> |

-

  ## Interfaces

  - [IAutomationSupport](https://developer.android.com/reference/android/support/test/uiautomator/IAutomationSupport)
  - [UiWatcher](https://developer.android.com/reference/android/support/test/uiautomator/UiWatcher)
-

  ## Classes

  - [By](https://developer.android.com/reference/android/support/test/uiautomator/By)
  - [BySelector](https://developer.android.com/reference/android/support/test/uiautomator/BySelector)
  - [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator)
  - [EventCondition](https://developer.android.com/reference/android/support/test/uiautomator/EventCondition)
  - [SearchCondition](https://developer.android.com/reference/android/support/test/uiautomator/SearchCondition)
  - [UiAutomatorInstrumentationTestRunner](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorInstrumentationTestRunner)
  - [UiAutomatorTestCase](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase)
  - [UiCollection](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection)
  - [UiDevice](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice)
  - [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)
  - [UiObject2](https://developer.android.com/reference/android/support/test/uiautomator/UiObject2)
  - [UiObject2Condition](https://developer.android.com/reference/android/support/test/uiautomator/UiObject2Condition)
  - [UiScrollable](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable)
  - [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)
  - [Until](https://developer.android.com/reference/android/support/test/uiautomator/Until)
-

  ## Enums

  - [Direction](https://developer.android.com/reference/android/support/test/uiautomator/Direction)
-

  ## Exceptions

  - [StaleObjectException](https://developer.android.com/reference/android/support/test/uiautomator/StaleObjectException)
  - [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException)