What testing strategy do you use for a mobile app, and what do you test at each level?
What the interviewer wants to hear
- Many fast unit tests for ViewModels, use cases and mappers
- Integration tests for repositories, database and network with fakes
- A smaller set of UI tests for key user journeys
- Snapshot or screenshot tests for visual regressions
- Run on CI, plus testing on real devices or device farms
Model answer
I follow the test pyramid. Most tests are fast unit tests for ViewModels, use cases, mappers and validation, with fake repositories and a test dispatcher so they are deterministic. Next are integration tests: Room or SQLite migrations, repository logic with a mock web server, and serialization of real API samples. On top is a small set of UI tests for critical journeys like login, checkout and onboarding, written with Compose testing or Espresso on Android, XCUITest on iOS, or Maestro or Detox for cross-platform apps, all against a fake backend. Screenshot tests catch visual regressions across themes and font sizes. Everything runs on CI for each pull request, and before release we run the UI suite on a device farm covering low-end devices and older OS versions.
Can you answer it under time pressure?
Take a timed medium round and get scored on every answer.
More medium Mobile App Developer questions
- How would you add offline support to an app that currently only works online?
- Users say a list in your app stutters while scrolling. How would you find and fix the problem?
- Walk me through how you release a new version of a mobile app to the stores.
- What is dependency injection and how have you used it in a mobile app?
- What security practices do you follow when building a mobile app?
- How do you manage state in a Flutter or React Native app as it grows beyond a few screens?
- How would you implement deep links in a mobile app from end to end?
- How do you make a mobile app accessible, and how do you check it?
- How would you set up CI/CD for a mobile app?