Our Android testing process
Article Summary
Headspace went from <20% test coverage to 80%+ during a complete app rewrite. Here's how they built a testing strategy that actually works.
The Headspace Android team shares their journey from minimal testing to a robust, multi-layered testing strategy. They detail how they balance speed with confidence using unit tests, integration tests, and E2E tests across 4,600+ test cases.
Key Takeaways
- Unit tests run in under 5 minutes for 4,600+ tests using MockK and Robolectric
- Integration tests with MockWebServer eliminated network flakiness that plagued E2E tests
- Tests categorized as Smoke, Regression, and MAT run at different pipeline stages
- Report Portal integration with Slack automates bug ticketing and simplifies test reporting
- Parallel testing with Flank across multiple devices cuts execution time dramatically
By tiering tests strategically and investing in tooling (Report Portal, Flank, MockWebServer), Headspace catches critical bugs pre-release without slowing down PRs.
About This Article
Headspace's E2E tests on Firebase Test Lab were unreliable. Network issues, REST API failures, and device problems kept breaking the CI pipeline, which made developers stop trusting the test suite.
The team switched to UI Integration Tests with OkHttp's MockWebServer to mock network requests. This replaced the flaky E2E tests with fast, reliable tests that could actually block pull requests.
Without external dependencies, the integration tests became stable enough to automatically prevent PRs from merging. Developers could ship code faster and had real confidence in quality without needing to manually review test results.