Q13 of 26 · Mobile QA

What does the test pyramid look like for a mobile application and where do Appium tests fit?

Mobile QAMidmobiletest-pyramidstrategyappiumunit-testingarchitecture

Short answer

Short answer: The mobile pyramid has a wide base of fast unit tests (ViewModel logic, business rules), a middle layer of integration tests (API, local storage, offline behaviour), and a thin top layer of Appium UI tests covering only the most critical user journeys. Appium tests are the most expensive to write, run, and maintain — use them sparingly.

Detail

Unit tests (base): on Android, JUnit tests for ViewModel logic, use case classes, repository interfaces; on iOS, XCTest unit tests for the same. These run on the JVM or host machine — milliseconds each, thousands of them.

Integration tests: these exercise multiple components together — API client + JSON parsing, Room/SQLite database operations, platform-specific components. On Android these run as instrumented tests on a real device or emulator but don't launch the full UI.

Appium/UI tests (top): full app launched, gestures and screen transitions exercised, assertions on visible UI state. These are slow (minutes per test on a device), expensive to maintain (selectors break on every UI redesign), and flaky on real devices. Limit them to: the critical purchase/sign-up flow, user journeys that exercise real hardware (camera, biometrics), and any cross-platform parity checks you can't cover lower in the stack.

The mobile pyramid is naturally steeper than the web equivalent — UI tests are more expensive on mobile because device provisioning, app install time, and gesture simulation add overhead that browser tests don't have.

// WHAT INTERVIEWERS LOOK FOR

Articulates why UI tests are more expensive on mobile, not just describes the pyramid shape. Names platform-specific unit test frameworks (JUnit, XCTest).