App update testing: verifying user data survives an upgrade
App update testing for iOS and Android: install the release users have, create real data, upgrade in place, and verify databases, sessions and prefs survive.
- Written by
- Yuvan Sundrani
- Read time
- 8 min read
- Published
.png)
Key Takeaways
- An update keeps the app's database, preferences and files; only an uninstall removes them. Every test that starts from a clean install skips the code that handles existing data.
- Room throws IllegalStateException when it finds no migration path, and fallbackToDestructiveMigration permanently deletes the user's tables instead.
- Core Data attempts a lightweight migration by default; a model change it can't infer fails the store load.
- iOS may purge Caches and tmp while the app isn't running, so cached files are never upgrade-safe state.
- Data created through the old build's UI exercises the old write path; fixtures seeded from the new build don't.
App update testing installs the release your users run, creates data through its UI, installs the candidate build over it, and checks that the data, the session and the settings survive a cold launch.
What data survives an app update?
Android's data storage overview marks app-specific files, app preferences and local databases as removed on uninstall. An update removes none of them. On iOS, the app's container stays in place across updates, with one documented exception: Apple's file system guide says the system may delete Caches to free space and may purge tmp while the app isn't running.
| Store | Platform | Survives the update | What breaks it |
|---|---|---|---|
| Room or raw SQLite | Android | Yes | Schema version bumped with no migration, or a destructive fallback |
| SharedPreferences, DataStore | Android | Yes | A renamed key or changed type reads as the default |
| Core Data store | iOS | Yes | A model change lightweight migration can't infer |
| SwiftData store | iOS | Yes | A schema change with no SchemaMigrationPlan stage |
| UserDefaults | iOS | Yes | A renamed key reads as missing |
| Keychain items (tokens) | iOS | Yes | A changed access group makes existing items unreadable |
| Caches, tmp | iOS | Not guaranteed | The system may purge them; the app must refetch |
In every row, the new build reads state the old build wrote, and a mismatch fails quietly. A missing preference becomes a default, a missing token becomes a login screen, a dropped table becomes an empty list. None of that crashes, so none of it fails a smoke test on a clean install.
App update testing steps on a device
- Install the build users have. Archive every release artifact by version. The store can't hand you last month's APK or IPA on demand, and a rebuild from the tag isn't the same binary.
- Create data through the old UI. Sign in, add the record types the release touches, change a setting. Seeding from the new code skips the old write path, which is where format mismatches come from.
- Cold-launch the old build once. Data visible before a process restart may only be in memory. Relaunching confirms it reached disk.
- Install the candidate over it. No uninstall, no clear.
- Cold-launch and verify. Same account, same records, same settings, no forced sign-in.
# Android (-r keeps the app's data)
adb install app-release-5.3.0.apk
# create data through the UI, then confirm it persisted
adb shell am force-stop com.example.app
adb shell monkey -p com.example.app -c android.intent.category.LAUNCHER 1
adb install -r app-release-5.4.0-rc1.apk
adb shell monkey -p com.example.app -c android.intent.category.LAUNCHER 1
# iOS Simulator: install over the existing app, then check the data container
xcrun simctl install booted MyApp-5.3.0.app
xcrun simctl launch booted com.example.app
xcrun simctl terminate booted com.example.app
xcrun simctl install booted MyApp-5.4.0.app
xcrun simctl get_app_container booted com.example.app data
xcrun simctl launch booted com.example.app
Both builds need the same signing identity. On Android, an APK signed with a different key fails to install over the existing one, which is why debug and release builds can't be mixed in this test.
Run more than one starting version. Users skip releases, so the path from two or three versions back runs a chain of migrations that the N-1 path never exercises.

Database migration tests for Room, Core Data
A device run proves the whole app. Migration tests prove the schema change on its own, faster, and on every commit.
Android's Room migration guide, now written for Room 3, provides MigrationTestHelper, which reads exported schema files to recreate older database versions. Two requirements come with it: the schema has to be exported and kept in version control, and the guide's own sample notes that the helper verifies schema changes while "you need to validate that the data was migrated properly."
// Room 3 testing artifact; the guide's sample, with the data check it asks for
val db = helper.runMigrationsAndValidate(2, listOf(MIGRATION_1_2))
// then query the migrated tables and assert on the rows you inserted at version 1
The same guide warns that fallbackToDestructiveMigration permanently deletes all data from the user's tables when no migration path exists. Shipping it to silence a crash trades a crash report for silent data loss.
On iOS, Apple's automatic migration guide describes lightweight migration as inferred from the differences between the source and destination models. shouldMigrateStoreAutomatically defaults to true; with it off, loading an out-of-date store produces an error. SwiftData moves the same decision into code: a SchemaMigrationPlan lists VersionedSchema types and the MigrationStage between each pair.
The crash log walkthrough for cloud devices covers reading the launch crash a failed migration produces.

Autosana for app update testing
Autosana is an AI end-to-end testing agent for iOS, Android and web apps. For upgrades, our Autosana sandboxes install the release users have, keep its data, and install the candidate over it, so the five steps above run without a local device.
Autosana key features for upgrade runs
- Any earlier build, by ID. autosana sandbox start --app-build-id <release-id> installs the exact release users run. Uploading every release from CI keeps each one addressable, and the Autosana Apps API lists an app's builds, so the previous release's ID is one call away.
- The candidate installed over the old app. autosana sandbox upload <path> installs the new build over the current one, and only --reset installs clean. That's what turns the run into an upgrade, with the old database, preferences and Keychain still in place.
- Cold launches with screenshot proof. launch --cold before and after the upgrade separates data that never reached disk from data lost in migration, and each step keeps its screenshot as the evidence attached to the release.
autosana sandbox start --app-build-id <release-5.3.0-build-id>
autosana sandbox launch --cold --description "5.3.0 after creating data"
autosana sandbox upload app-release-5.4.0-rc1.apk
autosana sandbox launch --cold --description "First launch of 5.4.0"
autosana sandbox look --description "Bookmark, session and settings after upgrade"

Uploading a release build to an app and environment, the first half of an upgrade test. Source: Autosana Apps docs video.
Autosana customer results
- Ziina (UAE financial platform) automated 69% of its E2E suite and cut active manual regression from about 12 hours across two days to about 1 hour. See the Ziina case study.
- Lucra (white-label social competition platform) automated about 70% of a 250-step regression suite in under 15 hours of effort, where scripting had been estimated in months.
The upgrade run belongs in the release smoke test gate.
It also belongs in the tests the regression testing guide re-runs when the schema changes.
Where Autosana fits less well
- A real-device sandbox can't host this check: its upload always installs clean.
- We don't run your MigrationTestHelper or XCTest suites; keep those as unit-level migration tests.
- Old app versions calling a changed backend need their own API compatibility tests.
Why use Autosana for app update testing?
- The real release, every time. Builds are addressed by ID, so the test starts from the binary users have.
- Upgrades are one command. upload without --reset installs over the old app and keeps its data.
- Lost data is caught before release. The cold launch after the upgrade shows whether records, session and settings survived.
- Proof for the release ticket. Before and after screenshots come from the same run.
- No upfront cost. Up to 1,000 AI actions a month are free on pay as you go.
Conclusion
Upgrade-in-place is easy to leave out of a suite where every other test starts clean. One run per release covers the case: release build, data through the UI, cold launch, candidate over the top, cold launch, compare.
The other half of upgrade risk sits on the server. Users who never update keep calling the API with the old app, and a backend change that drops a field breaks them with no client release to blame. Testing in production with feature flags and canaries covers that side.
FAQs
1. Does adb install -r keep app data?
Yes. -r reinstalls an existing app and keeps its data; both builds need the same signing key.
2. Why do upgrade bugs pass a clean-install test suite?
A clean install has no old database, preferences or tokens, so no migration code runs.
3. What happens when Room finds no migration path?
It throws IllegalStateException. A destructive fallback deletes the user's tables instead.
4. Does Core Data migrate automatically after a model change?
Lightweight migration runs by default when Core Data can infer the mapping between models.
5. Which versions should an upgrade test start from?
The current store release, plus one or two older versions still in use.
6. Can an Autosana sandbox install a new build over an old one?
Yes. autosana sandbox upload installs over the current app; only --reset installs clean.
Sources
- Android Developers: Migrate your Room database
- Apple Developer: Migrating your data model automatically


