Mobile Development
Mobile Testing: Unit, UI, and E2E
Shopify's mobile team publishes that a 1% increase in checkout crash rate costs millions in lost revenue during peak sales. Instagram's iOS team runs 80,000+ unit tests on every PR, completing in under 4 minutes on CI. Facebook's mobile infrastructure team developed snapshot testing internally before open-sourcing it because pixel regressions in their design system were reaching production undetected. Mobile testing is not a bureaucratic checkbox - it is the difference between a 3am pager alert and a quiet night.
- **Airbnb's Paparazzi** (open-sourced 2022) runs Android screenshot tests without an emulator, cutting their visual regression CI time from 45 minutes (emulator-based) to under 5 minutes - enabling snapshot testing on every PR rather than only on release branches.
- **Wix's Detox** was built after their React Native app had persistent E2E test flakiness with Appium (30-40% flake rate on CI). After migrating to Detox's gray-box synchronization, flake rate dropped below 2%, making E2E tests reliable enough to block merges.
- **Spotify's iOS team** maintains a test pyramid of 70% unit, 20% integration, 10% UI tests. Their CI runs unit tests in 3 minutes and full test suite in 25 minutes for an app with 400+ screens - achieved through strict component isolation with protocols and dependency injection.
XCTest and iOS Unit Testing
XCTest is Apple's native testing framework, integrated into Xcode. Unit tests subclass XCTestCase and run in a separate process from the app. Each test method name starts with 'test' and can assert values with XCTAssert*, XCTEqual, XCTThrowsError, and expectation-based async assertions. XCTest measures both correctness and performance via measureBlock, which runs a closure 10 times and reports mean, deviation, and baseline regressions.