Better Android Testing at Airbnb (Part 3)
Article Summary
Airbnb's Android team built a custom testing framework that runs thousands of automated tests across fragments without writing repetitive test code. Here's the architecture that makes it possible.
In Part 5 of their testing series, Airbnb engineer Eli Hart reveals the technical implementation behind their integration testing framework. This deep dive covers how they built on top of Espresso to automate screenshot and interaction tests at scale.
Key Takeaways
- Single custom Activity hosts all fragment tests using reflection and mock declarations
- Custom idle detection monitors Handler queues across multiple threads including Epoxy's background diffing
- Global exception handlers surface crashes with full context stack to developers
- Tests reduce to single line declarations per fragment with automatic generation
- Framework blocks fragment lifecycle calls to prevent tests from interfering with harness
Critical Insight
Airbnb created a testing architecture where one Activity processes all mocked fragments automatically, turning complex integration tests into single line declarations while solving idle detection and error handling challenges.