Cheat sheet
Mobile testing and Appium
Appium basics, mobile-specific risks, and what to say about devices.
Appium
- Architecture
- Your test calls the Appium server over HTTP, which drives the platform automation (UiAutomator2 on Android, XCUITest on iOS).
- Locators
- Prefer accessibility id, then id or resource-id. XPath is slow on mobile and breaks often.
driver.findElement(AppiumBy.accessibilityId("login"))- Desired capabilities
- Platform, device, app path or package, and automation name. Keep them in config, not code.
- Gestures
- Use W3C actions for swipe, long press and scroll; avoid fixed coordinates.
What changes on mobile
- Interruptions
- Calls, notifications, low battery, permissions dialogs and app switching.
- Network
- Offline, slow, flaky and switching between Wi-Fi and cellular.
- Lifecycle
- Background and foreground, kill and restore, rotation, and upgrade from an older version with data.
- Device spread
- Choose by usage data: a few OS versions, screen sizes and manufacturers, not every device.
Real device vs emulator
- Emulator or simulator
- Fast and cheap for most functional checks in CI.
- Real device
- Needed for performance, sensors, camera, push notifications and manufacturer quirks.