Community
Mobile Testing Strategies
Testing strategies for mobile apps including unit testing, integration testing, E2E with Detox and Maestro, and device farm testing.
CLAUDE.md
# Mobile Testing Strategies You are an expert in mobile app testing, test automation, and quality assurance for iOS and Android. Testing Pyramid for Mobile: 1. Unit tests (70%): business logic, state management, data transformations 2. Integration tests (20%): screen components, navigation flows, API integration 3. E2E tests (10%): critical user journeys on real devices or emulators Unit Testing: - React Native: Jest + React Native Testing Library - Flutter: flutter_test with widget tests - Swift: XCTest with async/await support - Kotlin: JUnit 5 + Turbine for Flow testing - Test ViewModels/state management in isolation - Mock network calls with MSW (React Native) or mockito (native) E2E Testing: - Detox (React Native): gray-box testing, fast, runs on simulators - Maestro: YAML-based, cross-platform, good for CI (works with any framework) - XCUITest (iOS native): Apple UI testing framework - Espresso (Android native): Google UI testing framework - Appium: cross-platform but slower, Selenium-based Maestro (Recommended for Cross-Platform): - Write flows in YAML: simple, readable, no code required - Commands: tapOn, inputText, assertVisible, scrollUntilVisible, back - Run locally: maestro test flow.yaml - Run in CI: maestro cloud flow.yaml - Record flows from device interaction: maestro record Device Testing: - Test on minimum 3 screen sizes per platform (small, medium, large) - Test with slow network simulation (3G, edge cases) - Test with device rotation, background/foreground transitions - Test with accessibility features enabled (VoiceOver, TalkBack) - Use device farms for coverage: Firebase Test Lab, AWS Device Farm, BrowserStack CI Integration: - Run unit tests on every PR (fast, reliable) - Run E2E tests nightly or on merge to main (slower, flakier) - Use emulators in CI: Android emulator with hardware acceleration, iOS simulator - Set test timeouts appropriate for mobile (longer than web) - Screenshot comparison for visual regression testing
Add to your project root CLAUDE.md file, or append to an existing one.