Mobile EngineeringVol. 22 · Mobile
0 / 0

Shelves / Mobile Engineering

MB·09

Testing, Release and Observability

Shipping mobile apps when every release is installed, not deployed: the mobile test pyramid (unit, integration, UI, screenshot, device-farm and manual testing on real low-end devices), CI with signing and build numbers, store testing tracks and review, staged rollouts and phased releases with halt criteria, why fixes reach users slowly and what server-side flags, remote config and minimum versions do about it, and release health in production (crash reporting with symbolication, ANRs, non-fatal errors, performance, analytics); with a lab simulating a bad build through a staged rollout and the weeks it takes users to move to a fix.

15 topics · ~8 min read · 16-question quiz
Updated Suggest a correction

Start here: you can't roll back a phone

On a server, a bad release is reverted in minutes (Volume 19, chapter 211G). On phones, a release is a binary that users install; once installed, it stays until they update. You can stop a rollout, but you can't uninstall what's already shipped, and a fixed version reaches users over days and weeks. Mobile release engineering is built around that fact:

  • Test more before shipping, especially on real, modest devices.
  • Release gradually and watch crash and performance metrics per version, halting early.
  • Keep risky behaviour switchable from the server (feature flags, remote config), so a bad feature can be turned off without a new build.

Measured (simulation)

A new build crashes in 0.5% of sessions instead of the usual 0.2%. TiffinBox has 50,000 daily users with 3 sessions each:

Release strategy Users who received the bad build
release to 100% at once 50,000 (about 450 extra crashed sessions a day)
staged rollout 1% → 5% → 20% → 50% → 100%, one stage a day, halting when crash rates differ significantly median 2,500 (halted on day 2, at 5%)

And after a fixed version is published (assuming a typical adoption curve):

Days after the fix Users still on the bad version
1 75%
3 42%
7 20%
30 4%

Staging limited the damage to 5% of users; but the users who had it kept it for weeks. A server-side kill switch would have reached all of them at their next request.

How deep to go

Volume 17 defines six mastery levels. For mobile testing and release:

Level What you can do
L1 Explain why mobile releases need staging and server-side control
L2 Write unit and UI tests, build and sign in CI, publish to testing tracks
L3 Explain rollout mechanics, adoption curves, symbolication and release-health metrics
L4 Diagnose crashes and ANRs from field reports and halt bad rollouts
L5 Design the release process, test strategy and flag system for a team
L6 Run releases weekly for years with predictable quality

The mobile test pyramid

Level Tools What it covers
unit JUnit, kotlinx-coroutines-test, Turbine; XCTest, Swift Testing ViewModels, domain logic, sync rules (chapter 05), with fakes
integration Room/SwiftData in-memory DBs, MockWebServer, URLProtocol stubs repositories, migrations, API parsing
UI Compose UI tests, Espresso; XCUITest critical journeys on one screen or across a few
screenshot Paparazzi, Roborazzi; swift-snapshot-testing visual regressions in components and themes
end-to-end on devices Firebase Test Lab, AWS Device Farm, BrowserStack the app against a staging backend on many real devices
manual exploratory real mid-range and low-end phones, slow networks, other languages what automation misses

Test the scenarios that break mobile apps specifically: process death (chapter 01), rotation and window resizing, offline and flaky networks (chapter 04), permission denial, low memory, dark mode, large fonts, right-to-left layouts and other languages (Volume 23), and upgrading from an old version with old local data.

CI and builds

  • Build every commit; run unit and screenshot tests on every pull request; UI and device tests on main and before release.
  • Signing: Android upload key and Play App Signing; iOS certificates and provisioning profiles managed by CI (Fastlane match, Xcode Cloud); keys in a secret manager, never in the repository.
  • Versioning: a user-facing version (2.14.0) and a monotonically increasing build number (versionCode, CFBundleVersion) for every upload.
  • Reproducible release builds with R8/stripping, and upload of mapping files and dSYMs to the crash reporter automatically.

Releasing through the stores

  • Tracks: internal testing → closed testing → open testing → production on Google Play; TestFlight internal and external groups on iOS.
  • Review: both stores review builds (Apple's review is generally stricter); plan for hours to days, and keep metadata, privacy declarations and permission justifications accurate.
  • Staged rollouts: Google Play lets you release to a percentage and increase it (or halt); Apple's phased release spreads automatic updates over 7 days (1%, 2%, 5%, 10%, 20%, 50%, 100%) and can be paused. Users can always update manually.
  • Halt criteria, written before release: e.g. crash-free sessions of the new version below the previous version's by a statistically significant margin, ANR rate above threshold, a spike in a key error or support tickets.
  • Release trains: a fixed cadence (weekly or fortnightly) with a branch cut, keeps releases small and routine.

Fixing faster than users update

  • Feature flags and remote config (with safe defaults compiled in) turn features on gradually and off instantly, independent of app versions.
  • Kill switches for risky features: the assistant's write tools, a new payment flow.
  • Server-driven behaviour where it fits: content, layouts of some screens, copy, limits.
  • Over-the-air updates of JavaScript bundles (React Native with Expo Updates) can fix JS-only bugs quickly, within store rules (no changes to the app's nature or native code).
  • In-app update prompts (Play's in-app updates API; your own prompt on iOS) encourage updates; a minimum supported version enforced by the API is the last resort.

Observability in the field

  • Crash reporting (Firebase Crashlytics, Sentry) with symbolication; group by issue; alert on new issues and on regressions per version.
  • ANRs and hangs: Android vitals and your reporter; iOS hang reports from MetricKit and Xcode Organizer.
  • Non-fatal errors: caught exceptions, failed syncs, rejected operations, logged with context but without personal data.
  • Performance: startup, screen rendering, network request timings by version and device class (chapter 06).
  • Analytics with a schema (event names and properties versioned like APIs, Volume 21), respecting consent.
  • Release health dashboard: per version, adoption, crash-free users and sessions, ANR rate, startup p90, key funnel conversion (subscribe, skip), ratings.

Common traps

  • Big-bang releases to 100%.
  • No mapping files, so crash reports are unreadable.
  • Features without kill switches.
  • Forced updates for convenience.
  • Testing only on new devices with fresh installs.

Lab: a bad build in a staged rollout

Setup. A NumPy simulation on the lab machine. Assumptions: 50,000 daily active users, 3 sessions each per day; the current version crashes in 0.2% of sessions, the new build in 0.5%. Rollout stages 1% → 5% → 20% → 50% → 100%, one stage per day. At the end of each day, the new version's crash rate is compared with the old version's using a two-proportion z-test; the rollout halts if z > 3. 2,000 simulated rollouts.

Experiment 1: staged versus all at once

Strategy Halted? Users who received the bad build
100% on day 1 (no stage to halt) 50,000 (≈ 450 extra crashed sessions per day)
staged, halting at z > 3 in 100% of runs; median at the 5% stage on day 2 median 2,500

Experiment 2: how long a bad version lives

Assumed adoption of a fixed version after it's published (a typical curve; real curves depend on auto-update settings, connectivity and user habits):

Day after the fix is published Users still on the bad version
1 75%
2 55%
3 42%
7 20%
14 10%
30 4%

A server-side flag change reaches every active user at their next request.

What it shows

  • Staged rollouts contain bad builds: the 1% stage (500 users, 1,500 sessions) usually didn't have enough sessions to prove a 0.3-point difference, but the 5% stage did, so about 2,500 users were affected instead of 50,000. Smaller differences need bigger stages or more days to detect; choose stage sizes and durations from the smallest regression you care about.
  • Containment isn't repair. Users who installed the bad build kept it for days to weeks after the fix. Anything risky enough to need a fast fix needs a server-side switch.
  • Combine both: staged rollouts for unknown risks in the binary, flags for known-risky features.

Try it yourself

  1. Set the bad build's crash rate to 0.3% (a smaller regression) and find how long it takes to halt.
  2. Halt on crash-free users rather than sessions and compare detection time.
  3. Model Apple's phased release (1%, 2%, 5%, 10%, 20%, 50%, 100% over 7 days) with the same test.
  4. Add a feature flag that disables the crashing feature on day 2 and compute total crashed sessions over 30 days with and without it.

Revision sheet: testing, release and observability

Key ideas

  • Shipped builds can't be rolled back; test more, release gradually, keep risk switchable from the server.
  • Test pyramid: unit, integration, UI, screenshot, device farms, manual on real modest devices; mobile-specific scenarios (process death, offline, permissions, upgrades).
  • CI builds, signing keys in secret managers, increasing build numbers, mapping files and dSYMs uploaded.
  • Store tracks, review, staged rollouts (Play) and phased release (App Store, 7 days), halt criteria written in advance, release trains.
  • Feature flags, remote config, kill switches, OTA JS updates within rules, in-app update prompts; minimum versions as a last resort.
  • Field observability: symbolicated crashes, ANRs/hangs, non-fatals, performance, schema'd analytics, release-health dashboards per version.

Numbers to remember

  • Simulation: staged rollout limited a bad build to ~2,500 of 50,000 users; 20% of users still on the bad version 7 days after the fix (assumed adoption).
  • Apple phased release: 1, 2, 5, 10, 20, 50, 100% over 7 days.

Glossary

  • Staged rollout / phased release: gradually increasing the share of users receiving a version.
  • Symbolication: mapping obfuscated or stripped stack traces back to source.
  • Remote config: server-delivered settings that change app behaviour without a release.
  • Release train: releases on a fixed schedule.
  • Crash-free users/sessions: release-health metrics per version.