lightbulb_outline Please take our October 2018 developer survey. Start survey


The testing framework is an Android Jetpack foundation component. See it in use in the Sunflower demo app.

The android-testing GitHub repository contains several collections of samples, which this document lists.

Espresso samples

Name Description
BasicSample Basic Espresso sample
CustomMatcherSample Shows how to extend Espresso to match the hint property of an EditText
DataAdapterSample Showcases the onData() entry point for Espresso, for lists and AdapterViews
IdlingResourceSample Synchronization with background jobs
IntentsBasicSample Basic usage of intended() and intending()
IntentsAdvancedSample Simulates a user fetching a bitmap using the camera
MultiWindowSample Shows how to point Espresso to different windows
RecyclerViewSample RecyclerView actions for Espresso
WebBasicSample Use Espresso-web to interact with WebViews.
BasicSampleBundled Basic sample for Eclipse and other IDEs

UiAutomator sample

Name Description
BasicSample Basic UI Automator sample

AndroidJUnitRunner sample

Name Description
AndroidJunitRunnerSample Showcases test annotations, parameterized tests and test suite creation

JUnit4 Rules sample

All previous samples use ActivityTestRule or IntentsTestRule, but there’s one specific to ServiceTestRule:

Name Description
BasicSample Simple usage of ActivityTestRule
IntentsBasicSample Simple usage of IntentsTestRule
ServiceTestRuleSample Simple usage of ServiceTestRule