Glossary

Espresso

What is Espresso?

Espresso (part of AndroidX Test) is Google's first-party UI testing framework for Android. Its defining feature is the IdlingResource mechanism: Espresso monitors the app's UI thread, AsyncTask pools, and registered custom IdlingResources to determine when the app is 'idle' before proceeding. This eliminates the need for Thread.sleep() calls and makes Espresso tests significantly more reliable than frameworks that use fixed timeouts. Espresso supports both black-box UI interactions (ViewMatchers, ViewActions, ViewAssertions) and integration with Robolectric for faster unit-level UI testing. It runs on real devices and emulators via Gradle's connectedAndroidTest task.

Espresso, frequently asked questions

Espresso is Google's official Android UI testing framework. It lets you write concise, readable tests that interact with your app's UI, finding views, performing actions, checking assertions. Its key advantage is automatic synchronisation with the UI thread: it waits for the app to be idle before each interaction, producing reliable tests without sleep() calls.