Better Android Testing at Airbnb (Part 2)
Article Summary
Airbnb's Android team was drowning in manual QA and flaky Espresso tests. Then they built a testing framework that changed everything.
Eli Hart from Airbnb Engineering shares how they transformed Android testing by building a comprehensive mocking system on top of MvRx (their open-source architecture library). This is Part 1 of a seven-part series on their testing infrastructure.
Key Takeaways
- MvRx architecture separates UI from business logic using immutable State classes
- Mock generation takes minutes via command-line script that reflectively analyzes ViewModels
- Custom DSL enables testing edge cases by creating State variants with minimal code
- MvRx Launcher lets developers jump to any screen with any mock state instantly
- Framework enables 100% code coverage without Espresso's flakiness or maintenance overhead
Airbnb built a mocking framework that makes comprehensive Android testing fast, stable, and maintainable by freezing ViewModels to specific states and auto-generating test data.
About This Article
Airbnb's app grew to hundreds of screens managed by dozens of teams. Without heavy investment in automated testing, they couldn't catch regressions reliably before release.
Eli Hart's team built a system that automatically analyzes ViewModel state and generates Kotlin data classes in minutes. This eliminated the manual work of creating test data.
The mocking framework integrates into MvRx so developers can test any screen state instantly through the MvRx Launcher. Instead of navigating nested flows, they can access states with a single click.