Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# android.test

*** ** * ** ***

A framework for writing Android test cases and suites.

For more information, see the [Testing](https://developer.android.com/tools/testing) developer guide.

<br />

## Annotations

|---|---|
| [FlakyTest](https://developer.android.com/reference/android/test/FlakyTest) | *This @interface was deprecated in API level 24. Use [FlakyTest](https://developer.android.com/reference/android/support/test/filters/FlakyTest) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [RepetitiveTest](https://developer.android.com/reference/android/test/RepetitiveTest) | *This @interface was deprecated in API level 29. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [UiThreadTest](https://developer.android.com/reference/android/test/UiThreadTest) | *This @interface was deprecated in API level 24. Use [UiThreadTest](https://developer.android.com/reference/android/support/test/annotation/UiThreadTest) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |

## Interfaces

|---|---|
| [PerformanceTestCase](https://developer.android.com/reference/android/test/PerformanceTestCase) | *This interface was deprecated in API level 24. Use [AndroidJUnitRunner](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [PerformanceTestCase.Intermediates](https://developer.android.com/reference/android/test/PerformanceTestCase.Intermediates) | Callbacks for `https://developer.android.com/reference/android/test/PerformanceTestCase`. |
| [TestSuiteProvider](https://developer.android.com/reference/android/test/TestSuiteProvider) | *This interface was deprecated in API level 24. Use [AndroidJUnitRunner](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |

## Classes

|---|---|
| [ActivityInstrumentationTestCase](https://developer.android.com/reference/android/test/ActivityInstrumentationTestCase)\<T extends [Activity](https://developer.android.com/reference/android/app/Activity)\> | *This class was deprecated in API level 3. new tests should be written using `https://developer.android.com/reference/android/test/ActivityInstrumentationTestCase2`, which provides more options for configuring the Activity under test* |
| [ActivityInstrumentationTestCase2](https://developer.android.com/reference/android/test/ActivityInstrumentationTestCase2)\<T extends [Activity](https://developer.android.com/reference/android/app/Activity)\> | *This class was deprecated in API level 24. Use [ActivityTestRule](https://developer.android.com/reference/android/support/test/rule/ActivityTestRule) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [ActivityTestCase](https://developer.android.com/reference/android/test/ActivityTestCase) | *This class was deprecated in API level 24. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [ActivityUnitTestCase](https://developer.android.com/reference/android/test/ActivityUnitTestCase)\<T extends [Activity](https://developer.android.com/reference/android/app/Activity)\> | *This class was deprecated in API level 24. Write [Local Unit Tests](https://developer.android.com/training/testing/unit-testing/local-unit-tests) instead.* |
| [AndroidTestCase](https://developer.android.com/reference/android/test/AndroidTestCase) | *This class was deprecated in API level 24. Use [InstrumentationRegistry](https://developer.android.com/reference/android/support/test/InstrumentationRegistry) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [AndroidTestRunner](https://developer.android.com/reference/android/test/AndroidTestRunner) | *This class was deprecated in API level 24. Use [AndroidJUnitRunner](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [ApplicationTestCase](https://developer.android.com/reference/android/test/ApplicationTestCase)\<T extends [Application](https://developer.android.com/reference/android/app/Application)\> | *This class was deprecated in API level 24. Use [InstrumentationRegistry](https://developer.android.com/reference/android/support/test/InstrumentationRegistry) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [InstrumentationTestCase](https://developer.android.com/reference/android/test/InstrumentationTestCase) | *This class was deprecated in API level 24. Use [InstrumentationRegistry](https://developer.android.com/reference/androidx/test/platform/app/InstrumentationRegistry) instead. New tests should be written using the [AndroidX Test Library](https://developer.android.com/training/testing).* |
| [InstrumentationTestRunner](https://developer.android.com/reference/android/test/InstrumentationTestRunner) | *This class was deprecated in API level 24. Use [AndroidJUnitRunner](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [InstrumentationTestSuite](https://developer.android.com/reference/android/test/InstrumentationTestSuite) | *This class was deprecated in API level 24. Use [InstrumentationRegistry](https://developer.android.com/reference/android/support/test/InstrumentationRegistry) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [IsolatedContext](https://developer.android.com/reference/android/test/IsolatedContext) | *This class was deprecated in API level 24. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [LaunchPerformanceBase](https://developer.android.com/reference/android/test/LaunchPerformanceBase) | Base class for all launch performance Instrumentation classes. |
| [LoaderTestCase](https://developer.android.com/reference/android/test/LoaderTestCase) | A convenience class for testing `https://developer.android.com/reference/android/content/Loader`s. |
| [MoreAsserts](https://developer.android.com/reference/android/test/MoreAsserts) | *This class was deprecated in API level 24. Use [Hamcrest matchers](https://github.com/hamcrest) instead.* |
| [ProviderTestCase](https://developer.android.com/reference/android/test/ProviderTestCase)\<T extends [ContentProvider](https://developer.android.com/reference/android/content/ContentProvider)\> | *This class was deprecated in API level 5. this class extends InstrumentationTestCase but should extend AndroidTestCase. Use ProviderTestCase2, which corrects this problem, instead.* |
| [ProviderTestCase2](https://developer.android.com/reference/android/test/ProviderTestCase2)\<T extends [ContentProvider](https://developer.android.com/reference/android/content/ContentProvider)\> | This test case class provides a framework for testing a single `https://developer.android.com/reference/android/content/ContentProvider` and for testing your app code with an isolated content provider. |
| [RenamingDelegatingContext](https://developer.android.com/reference/android/test/RenamingDelegatingContext) | *This class was deprecated in API level 24. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [ServiceTestCase](https://developer.android.com/reference/android/test/ServiceTestCase)\<T extends [Service](https://developer.android.com/reference/android/app/Service)\> | *This class was deprecated in API level 24. Use [ServiceTestRule](https://developer.android.com/reference/android/support/test/rule/ServiceTestRule) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [SingleLaunchActivityTestCase](https://developer.android.com/reference/android/test/SingleLaunchActivityTestCase)\<T extends [Activity](https://developer.android.com/reference/android/app/Activity)\> | *This class was deprecated in API level 24. Use [ActivityTestRule](https://developer.android.com/reference/android/support/test/rule/ActivityTestRule) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [SyncBaseInstrumentation](https://developer.android.com/reference/android/test/SyncBaseInstrumentation) | *This class was deprecated in API level 24. Use [InstrumentationRegistry](https://developer.android.com/reference/android/support/test/InstrumentationRegistry) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [TouchUtils](https://developer.android.com/reference/android/test/TouchUtils) | *This class was deprecated in API level 24. Use [Espresso UI testing framework](https://developer.android.com/training/testing/ui-testing/espresso-testing) instead. New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* |
| [ViewAsserts](https://developer.android.com/reference/android/test/ViewAsserts) | *This class was deprecated in API level 24. Use [Espresso View Matchers](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers) instead. New test should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library). For more information about UI testing, take the [Espresso UI testing](https://developer.android.com/tools/testing-support-library) training.* |

## Errors

|---|---|
| [AssertionFailedError](https://developer.android.com/reference/android/test/AssertionFailedError) | *This class was deprecated in API level 16. use junit.framework.AssertionFailedError* |
| [ComparisonFailure](https://developer.android.com/reference/android/test/ComparisonFailure) | *This class was deprecated in API level 16. use org.junit.ComparisonFailure* |

-

  ## Annotations

  - [FlakyTest](https://developer.android.com/reference/android/test/FlakyTest)
  - [RepetitiveTest](https://developer.android.com/reference/android/test/RepetitiveTest)
  - [UiThreadTest](https://developer.android.com/reference/android/test/UiThreadTest)
-

  ## Interfaces

  - [PerformanceTestCase](https://developer.android.com/reference/android/test/PerformanceTestCase)
  - [PerformanceTestCase.Intermediates](https://developer.android.com/reference/android/test/PerformanceTestCase.Intermediates)
  - [TestSuiteProvider](https://developer.android.com/reference/android/test/TestSuiteProvider)
-

  ## Classes

  - [ActivityInstrumentationTestCase](https://developer.android.com/reference/android/test/ActivityInstrumentationTestCase)
  - [ActivityInstrumentationTestCase2](https://developer.android.com/reference/android/test/ActivityInstrumentationTestCase2)
  - [ActivityTestCase](https://developer.android.com/reference/android/test/ActivityTestCase)
  - [ActivityUnitTestCase](https://developer.android.com/reference/android/test/ActivityUnitTestCase)
  - [AndroidTestCase](https://developer.android.com/reference/android/test/AndroidTestCase)
  - [AndroidTestRunner](https://developer.android.com/reference/android/test/AndroidTestRunner)
  - [ApplicationTestCase](https://developer.android.com/reference/android/test/ApplicationTestCase)
  - [InstrumentationTestCase](https://developer.android.com/reference/android/test/InstrumentationTestCase)
  - [InstrumentationTestRunner](https://developer.android.com/reference/android/test/InstrumentationTestRunner)
  - [InstrumentationTestSuite](https://developer.android.com/reference/android/test/InstrumentationTestSuite)
  - [IsolatedContext](https://developer.android.com/reference/android/test/IsolatedContext)
  - [LaunchPerformanceBase](https://developer.android.com/reference/android/test/LaunchPerformanceBase)
  - [LoaderTestCase](https://developer.android.com/reference/android/test/LoaderTestCase)
  - [MoreAsserts](https://developer.android.com/reference/android/test/MoreAsserts)
  - [ProviderTestCase](https://developer.android.com/reference/android/test/ProviderTestCase)
  - [ProviderTestCase2](https://developer.android.com/reference/android/test/ProviderTestCase2)
  - [RenamingDelegatingContext](https://developer.android.com/reference/android/test/RenamingDelegatingContext)
  - [ServiceTestCase](https://developer.android.com/reference/android/test/ServiceTestCase)
  - [SingleLaunchActivityTestCase](https://developer.android.com/reference/android/test/SingleLaunchActivityTestCase)
  - [SyncBaseInstrumentation](https://developer.android.com/reference/android/test/SyncBaseInstrumentation)
  - [TouchUtils](https://developer.android.com/reference/android/test/TouchUtils)
  - [ViewAsserts](https://developer.android.com/reference/android/test/ViewAsserts)
-

  ## Errors

  - [AssertionFailedError](https://developer.android.com/reference/android/test/AssertionFailedError)
  - [ComparisonFailure](https://developer.android.com/reference/android/test/ComparisonFailure)