Lyft Oct 12, 2022

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

Critical Insight

Lyft reduced iOS test time by 94% and eliminated pre-assertion failures by testing features in isolation with proper state injection.

The article reveals how they extended their dependency injection system to make this work without rewriting their entire test suite.

About This Article

Problem

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.

Solution

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.

Impact

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.

Recent from Lyft

Related Articles