How 40 Lines of Code Sped Up iOS End to End Tests by over 50%
Article Summary
Wealthfront's iOS team cut E2E test time in half with just 40 lines of code. The culprit? A 1-second polling interval nobody questioned.
With 30k unit tests and nearly 1k E2E tests, Wealthfront's iOS team prioritized reliability over speed using XCTWaiter. But they discovered Apple's polling mechanism was blocking for a full second between checks, a design from the pre-M-series era that was killing performance.
Key Takeaways
- XCTWaiter polls every 1 second, blocking the test runner unnecessarily
- Custom polling at 0.1s intervals achieved 80% local speedup initially
- Exponential backoff (0.2s to 2s) prevented CI crashes from CPU overload
- Final result: 50% faster CI pipelines with stable parallel execution
Critical Insight
By replacing Apple's outdated XCTWaiter with a custom polling mechanism using exponential backoff, Wealthfront achieved 50% faster E2E tests on CI and 80% locally.