Espresso

developer.android.com ↗

An Android UI testing framework for expressing screen actions and assertions in app tests.

SI Score
80/100
Pricing
Open Source AI reading, not confirmed
Free plan
Not confirmed
Sign-up required
Not confirmed

Ask SI about Espresso

Answers use saved listing facts and recorded sources.
Homepage screenshot
Screenshot of the Espresso homepage

What it does

Espresso is a framework for writing UI tests against Android applications. A test locates views with matchers, performs actions such as typing or tapping, and checks that the resulting interface state matches an expectation. Espresso synchronizes actions with the app's main message queue and registered idling resources, which helps tests interact with the UI when it is idle. The framework is most useful to developers familiar with the codebase under test.

Write tests in the language of the screen

Espresso tests work with an Android app project and an instrumented test target. In an illustrative test, a developer locates a field by its resource ID, types a sample name, taps a greeting control, and asserts that the expected text is displayed. The Android guide shows this interaction-and-assertion style in both Kotlin and Java. Espresso's onView() call waits for relevant UI synchronization conditions, including an idle message queue and developer-defined idling resources, rather than asking each test to add arbitrary sleeps.

To set up the project, the official instructions add Espresso, AndroidX Test runner, and rules dependencies to the app module's Gradle configuration, then select AndroidJUnitRunner as the instrumentation runner. Tests can be run from Android Studio or with the documented Gradle connected-test task on a virtual or physical device. Android Studio is recommended. The setup guide also recommends turning off device animations to reduce flakiness. These are documented steps only; no app or test was run for this listing.

Espresso is not a general browser or desktop automation tool. It is aimed at Android UI tests and gains its strongest capabilities when a test author understands the application code.

Strengths

  • The matcher, action, and assertion pattern lets a test describe user-visible interactions directly.
  • Built-in synchronization waits for the app to reach documented idle conditions before UI actions and assertions.
  • Additional packages support WebView interactions, intent testing, accessibility checks, and other Android UI cases.

Watch out for

  • Tests require an Android app project, an instrumentation runner, and a virtual or physical test device.
  • The framework is specialized for Android application interfaces rather than cross-platform browser testing.

Best for

  • Android developers verifying common in-app user flows
  • Teams that need deterministic UI interactions in instrumented tests
  • Developers testing app screens, WebViews, or Android intents

Sources