Q14 of 26 · Mobile QA

How do you test push notifications in a mobile application without relying on production infrastructure?

Mobile QAMidmobilepush-notificationsfcmapnstestingappium

Short answer

Short answer: Test the notification payload handler in isolation using unit tests with a mocked notification object. For device-level delivery, use the APNs/FCM sandbox environment and send test payloads directly from a script or the Firebase console. Verify appearance, deep-link routing, badge count, and behaviour when tapped.

Detail

There are three distinct layers to test:

Payload handling (unit): the code that receives a notification payload and decides what to do (navigate, update badge, show in-app banner). Test this by constructing a notification payload object in a unit test and calling the handler directly — no device needed, runs in milliseconds.

Delivery (integration): send a real push notification to a test device using the sandbox environment. For iOS, use the APNs sandbox (api.sandbox.push.apple.com) with a test certificate. For Android, use FCM's REST API pointing at your test app's registration token. The Firebase console's test notification feature is the quickest way to do this manually.

UI behaviour (Appium): once the notification is delivered, automate: (1) verify the notification banner appears, (2) tap the banner and assert the app navigates to the correct deep-linked screen, (3) verify the app badge count updates, (4) test the notification when the app is in the foreground vs background vs terminated.

The most commonly missed case: notifications received while the app is terminated (fully closed). These use a different code path from background notifications and are a frequent source of bugs.

// WHAT INTERVIEWERS LOOK FOR

Distinguishes the three layers — payload handling (unit), delivery (integration), UI behaviour (Appium). Notes the terminated-state edge case.

// COMMON PITFALL

Testing push notifications only manually from the Firebase console. This doesn't catch payload-handler bugs, doesn't run in CI, and doesn't cover edge cases like malformed payloads.