How to Test Push Notifications on iOS devices
By Jash Unadkat, Technical Content Writer at BrowserStack - April 12, 2021
Push notifications are an integral part of any mobile apps. They motivate users to interact with the app, increase the app’s outreach, promote its services/functions and keep users engaged as much as possible.
Push notifications are useful for marketing and advertising purposes. Naturally, testing and validating the appearance of push notifications at regular intervals is a priority for app development and QA teams.
This article will demonstrate how developers or QAs can test push notifications for both published and work-in-progress iOS apps on real iPhones and iPads.
Testing Push Notifications on Real iOS Devices
Teams often prefer using iOS simulators for testing push notifications. However, it’s a daunting task to find simulators for each device type. Testing on simulators also means compromising with the accuracy of the test results. Moreover, downloading and installing several emulators or simulators just for the sake of testing push notifications is an inefficient and effort-intensive approach. An efficient alternative is to opt for a cloud-based platform that offers real mobile devices for instant testing.
BrowserStack’s real device cloud allows developers or QAs to choose from a wide range of real iPhones and iPads for manual and automated testing of iOS apps. Additionally, one can also test native device features like Geolocation testing, Push Notifications, Network Simulation, and numerous others.
Refer to the complete set of native device features supported by App-live here.
Note: Testing push notifications online for iOS on BrowserStack is available for devices on iOS 10 and above. Try now.
Testing Push Notification on Unpublished or Under-Development iOS Apps
To begin with testing push notifications for a work in progress app on a specific iOS device, follow the steps below:
1. Signup for free or purchase a specific plan for Browserstack App-Live.
2. Once the App-live dashboard opens up, select the – Install via TestFlight option.
(Note: To test push notifications for apps under development, using the Install via Test Flight option is mandatory).
3. After clicking on the Install via TestFlight option, select a device to test on.
4. Once the device loads, log in using an existing Apple ID or by creating a new one.
Note: While entering the password, users will not be able to see the password showing up in its data field. For security reasons, Apple does not allow the password to be displayed during streaming. Don’t worry about this. Simply complete typing the password and proceed to Sign in.
Refer to this FAQ section to know more about the Login process for Test Flight and AppStore.
5. Choose from the available apps in TestFlight. It will download and install the app on the selected device (iPhone 12 in this case).
6. Once the app is downloaded and installed, trigger a push notification using a service like FCM (or one preferred by the specific team). Once triggered, the push notification will show up in the notification panel.
Key Update: BrowserStack App-live now also supports testing push notifications for directly uploaded apps via computer or URL with the recently launched support for iOS entitlements.
However, developers or QAs must ensure that the app to be tested for push notifications, needs to be signed with an iOS Enterprise distribution certificate.
To enable iOS entitlement for an app -> Upload the app on the App-Live dashboard using the ‘Upload from computer’ or ‘Upload via URL’ option.
Once the app is uploaded, click on the Gear icon next to the app listing and turn on the iOS entitlement switch.
Further, Click on the desired iOS Device from the right panel to launch a test session with iOS Entitlement testing enabled!
One must bear in mind that these settings can be changed by any other user in your team having access to the uploaded app on BrowserStack App Live. So one must check the App Configurations section once before launching the session to ensure that the Configurations are set according to your requirements.
Recommended Read: How to debug on iPhone
Testing Push Notifications for Published iOS Apps
One can also directly download an app from App Store and test push notifications for the same. For this, select the Install via AppStore feature and the desired iOS device on the App Live Dashboard. Refer to the image below for clarity:
Once the device loads, open the App Store and log in using the Apple ID and Two-factor authentication.
Once signed in, search and install the app to be tested from the App Store. After this, repeat the step number 6 listed above.
Consider the example below of a sample push notification from Facebook on iPhone 12
The Facebook App is directly downloaded from App Store and tested for Push Notifications on a real iPhone 12.
Note: Users will be prompted to enter the password of their Apple ID before downloading any particular app directly from AppStore. This is a mandatory step.
As mentioned earlier, testing push notifications on the iOS simulator will not help in achieving comprehensive test coverage. Moreover, installing and configuring simulators for each device prior to testing push notifications will be very time-consuming and inefficient.
Testing on real iOS devices is unarguably the best way to validate any functionality for iOS apps as it helps yield accurate test results. Testing push notifications across real iOS devices will help teams evaluate the functionality and appearance of notifications on a wide range of iPhones and iPads in a hassle-free manner. The illustration above will help developers or individual testers easily execute push notification testing on real iOS devices.