In the android-testing GitHub repository you’ll find a collection of samples:

Espresso Samples

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

BasicSample Basic UI Automator sample

AndroidJUnitRunner Sample

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:

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