A deep link opens the right screen when the app is in the background and the wrong one when the app was killed. How do you test for that?
Treat each launch state as its own test case, because each delivers the link through a different code path. Cold start runs splash, auth and initialisation that can drop the link, and on iOS delivers it in the scene's connection options, not the continue callback. Test cold, warm, restored and logged-out.
Answer
Short answer
A deep link that works when backgrounded and fails when killed is a launch-state bug. Each launch state hands the link to the app through a different code path, so mobile testing has to cover each one deliberately. Cold start goes through splash, auth checks and initialisation that can drop or override the link, and on iOS the link arrives in the scene's connection options instead of the callback the warm path uses.
| Launch state | How it arises | What usually breaks |
|---|---|---|
| Cold | Process not running | Link discarded by splash, auth or start-up routing |
| Warm or hot | Process alive, app in background | Link handled by onNewIntent or scene(_:continue:) |
| Restored | Process killed by the OS, task still in recents | Saved state and the link fight over the screen |
| Foreground | App already open | In-app routing from a notification or link |
| Logged out | Any of the above, no session | Link lost after the login screen |
Was this answer helpful?
Likely follow-ups
- After the user logs in from a cold-start deep link, how do you make sure they land on the linked screen rather than home?
- Why can reopening the app from the recents screen take the user back to an old deep link, and how would you test for it?
- What does the back button do after a cold-start deep link, and what should it do?
- How would you automate the cold-start case in CI without a person tapping a link?
Related questions
- How do you choose which devices to test on, and what will an emulator never tell you?mediumAlso on mobile-testing and android5 min
- What makes testing a mobile app different from testing a web application?mediumAlso on mobile-testing and app-lifecycle6 min
- A Compose screen with a long list is janky while scrolling - walk through how you'd find and fix the recomposition problem causing it.mediumAlso on android5 min
- How do retain cycles happen in Swift closures and delegates, and how would you find one in an app that is slowly leaking memory?mediumAlso on ios4 min