Testing Strategy & Pyramid
TESTING › Strategy
How to balance unit, integration, and UI tests and what each layer should verify.
Interviewers use this topic to see whether you can design a fast, trustworthy test suite rather than just write assertions. Expect questions on the test pyramid, local vs instrumented tests, test doubles, and how testable architecture lets you unit-test ViewModels and repositories. They probe what you deliberately do not test and why.
What this covers
- The test pyramid: many fast unit tests, fewer integration tests, fewest slow UI/E2E tests
- Local (host/JVM) tests vs instrumented (device/emulator) tests and the speed/fidelity tradeoff
- What to test (your logic, state, edge cases) vs what not to test (the framework, getters, trivial code)
- Using fakes vs mocks to isolate the subject under test
- Unit-testing ViewModels with fake repositories and a controllable test dispatcher
- Why decoupled, framework-free architecture makes more code unit-testable
Study this topic
- Testing Strategy & Pyramid explained: the guided lesson
- 14 practice quiz questions
- 9 revision flashcards
- Testing Strategy & Pyramid interview questions and answers