OnPath Testing Blog

You've Got Notices! The Intricacies of Testing Push Notifications

Written by Ritinder Kaur | Mar 21 2014

Applications which use messaging features like SMS and texting are referred to as Messenger applications. Push notifications are an important part of such applications. These are instant alerts – audio and visual – which appear immediately when the user is online. Even when the user is not using the app, these notifications alert them about any messages received.

The notification appears as audio (i.e. a sound alert) and as a visual notification on the notification panel.

It is important to keep in mind that notifications are facilitated by the operating system (OS) of the mobile device and are utilized by the application. The OS governs the potential and the limitations of the notifications. Every OS has inbuilt libraries which are used by the app developers for writing the code for the app and its notifications.

The most popular OS available on mobile devices is iOS followed by Android, Windows, and Blackberry among others. There are other apps like news apps, mailing apps, battery saving apps and device security apps where push notifications are equally important.

Notifications are designed with special attention to the fact that the application has to work across platforms so that users of either OS should be able to communicate with each other. Similarly, for the testing of the app and the notifications, software testing services have to be used across these platforms.

Push notifications have to be developed and tested keeping in mind that there are different states of the application (whether it is in the foreground or the background). Also, there are different states in which the mobile device may be at a particular point in time – it may be locked, offline or may have been purposely or inadvertently (if the battery dies) switched off.

  • When the application is being run in the foreground, there are two possible scenarios:
    • When the user is in a chat thread with another user and receives another message from the same user, they will not receive any notification, audio or visual in both iOS and Android devices.
Chat thread on an Android device Chat thread on iOS device

In case they are in a chat thread with a user and another user sends a message or if they are on another screen within the same app, they will receive audio and visual notification on an Android device. However, on an iOS platform, only audio notification will be received.

  • When a messenger app is being run in the background, the notification will ideally display the exact nature of the message received, whether it is an audio message, a photo, a video, a sticker or simple text.
    • In Android OS, when a message is received, the sender’s name and the message is displayed on the notification panel. If the message is long, only its initial part is displayed. Tapping on the notification will take the user to the chat thread in the application. In case the user does not tap on the notification, the icon of the app will still be displayed on the notification panel till such time that the user accesses it through the system panel.
Notification panel displays the name of the sender and the message received; the app icon stays on till the user accesses it
Accessing the system panel displays the app icon, the name of the sender and the message

If more than one messages have been received from the same sender or different senders, they will not be displayed separately, but will be listed together as, say, ‘2 messages from 2 conversations’.

On an iOS device, the notification will be displayed for a few seconds and will then disappear; so there is no way to notify the user that a message has been received. They will come to know of the messages received only once they access the app in the foreground. iOS devices will display every message separately with the name of the sender, even if they are from the same sender.

Across both platforms, however, once the user brings the app into the foreground, they can view the badge count to see the total number of new messages on the messages screen. They will be able to see the unread messages indicated with a blue button with the name of the respective senders on the messages screen. Tapping on any message will take the user to that specific chat thread.

  • In case an Android device is locked, it will still receive audio and visual notification but the screen will not display the notification until the user decides to unlock it.

An iOS device also receives audio and visual notification in the locked state. However, this platform gives the user the option to set the screen to off/on so that as soon as it is received, the locked screen displays the notification automatically.

 

  • Notifications have to be designed and tested using software testing tools keeping in mind that the mobile device may not always be online. In case it is offline or switched off purposely or advertently (as its battery may have died out), it is important to ensure that the user is alerted to the notifications as soon as they are online. In such cases, the notifications are displayed on the lock screen.

On an iOS device, if more than 1 message or calls have been received from the same sender, then the last message is displayed. In case messages have been received from more than one sender, then the last message of the sender who sent the most recent message will be displayed as a notification on the lock screen.

When an Android device is switched on, the count of all the messages received will be listed as, say, ‘4 new messages from 3 conversations’.

 

Push Notifications Overview

    iOS   Android  
States Scenarios Audio Visual Audio Visual
Foreground When user is in same chat thread None None None None
When user is in different chat thread or on another screen Yes None Yes Yes
Background When app is running in the background Yes Yes; icon disappears from notification panel after a few seconds Yes Yes; icon stays on notification panel
When app is closed Yes Yes; icon disappears from notification panel after a few seconds Yes Yes ; icon stays on notification panel
Phone locked   Yes Yes ; lock screen lights up to display the notification Yes Yes; but lock screen does not light up to display the notification
Offline   Yes; once the phone is online Yes Yes Yes
Switched off   Yes; once the phone is switched on Yes; once the phone is switched on Yes; once the phone is switched on Yes; once the phone is switched on