Skip to content

Most visited

Recently visited


Testing App Component Integrations

You should also read

If your app uses components that users do not directly interact with, such as a Service or Content Provider, you should validate that these components behave in a correct way with your app.

When developing such components, you should get into the habit of writing integration tests in order to validate the component's behavior when your app runs on a device or an emulator.

Note: Android does not provide a separate test case class for BroadcastReceiver. To verify that a BroadcastReceiver responds correctly, you can test the component that sends it an Intent object. Alternatively, you can create an instance of your BroadcastReceiver by calling InstrumentationRegistry.getTargetContext(), then call the BroadcastReceiver method that you want to test (usually, this is the onReceive() method).

This class teaches you to build automated integration tests using the testing APIs and tools that the Android platform provides.


Testing Your Service
Learn how to build integration tests to verify that a service works correctly with your app.
Testing Your Content Provider
Learn how to build integration tests to verify that a content provider works correctly with your app.
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)