Shift-Left iOS Testing with Focus Flows
Article Summary
Lyft's iOS tests were spending 93% of their time on steps that had nothing to do with what they were actually testing. Sound familiar?
The Lyft mobile team introduced Focus Flows, a testing approach that lets you start tests from any screen in your app instead of clicking through the entire user journey. It's built on their Flow Architecture and leverages Bazel for rapid iteration.
Key Takeaways
- Traditional UI tests fail on login issues when testing payment screens
- Focus Flows cut test execution time from 32 seconds to 2 seconds
- Tests start at target screen with injected state, no navigation needed
- Flakiness drops dramatically by eliminating irrelevant pre-assertion steps
- Built on composable routers, not monolithic navigation patterns
Lyft reduced iOS test time by 94% and eliminated pre-assertion failures by testing features in isolation with proper state injection.
About This Article
The Lyft Pass details screen had automated UI tests that required going through 9 unnecessary steps like login, the hamburger menu, and payment selection. When unrelated components broke, these tests would fail before even reaching what they were supposed to check, and the extra navigation slowed everything down.
Lyft built Focus Flows using composable routers and dependency injection. Tests can now start directly at the target screen with pre-configured session state that includes authentication, feature flags, and location data. This cuts out all the navigation overhead.
Focus Flow tests now run in 2 seconds instead of 32 seconds. They also stopped failing when unrelated UI parts broke. Teams can iterate faster on individual features without waiting for the full application to compile.