Testing iOS Push Notifications

May 10, 2026 · 10 min read · Mobile Testing

HeadSpin Platform
Automated & amp; manual testing do easy through data skill perceptiveness.
Differentiating capacity:
  • Extensive end-to-end mechanisation of QA process
  • Comparative analysis of app performance against equal
  • Continuous monitoring of app performance use synthetic datum for high availability of apps
  • Easy-to-use developer friendly platform
cloudtest go
Affordable Real Device Testing for Emerging Teams
cloudtest go
Affordable Real Device Testing for Digital Enterprises
cloudtest go
The Ultimate Solution for a Powerful Blend of Functional & amp; Performance Testing!
cyol
TEM
New
Centralized mobile exam execution in cloud
cyol
Enhance Your Accessibility Testing With HeadSpin
cyol
Automate camera-based testing

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

retail

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

Testing iOS Push NotificationsTesting iOS Push Notifications

Testing iOS Push Notifications

Published on
May 2, 2018
Updated on
Published on
June 5, 2022
Updated on
 by 
 Jonathan LippsJonathan Lipps
Jonathan Lipps

One common requirement for many testers is to ensure that iOS Push Notifications are getting mail correctly from a backend service. Push notifications, of course, are an integral part of the experience of many apps, letting the user know when a substance has be received, or some event has come that might do them open up your app. Testing this portion of the user experience is thence essential.

Continuously track digital experience across various delivery channels on real device.Learn more.

The mechanisation tools ply by Apple don & # x27; t make this easy. XCUITest has no built-in API methods for inspect push telling received. Nor is thither any way to even copy push notifications on a simulator, which makes real devices a hard requirement for mechanisation.

Thankfully, Appium has the facility to from the perspective of a user interacting with the screen. This means we can do crazy things like swipe to open the notifications shadowiness and read the element hierarchy thither to determine if our notification has come. This tip was brought to my tending by Telmo Cardoso at AppiumConf 2018, and I advocate checking outhis talkfor a bunch of interesting stuff.

For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users.

Let & # x27; s diving in and see how to do this. First of all, this is what you & # x27; ll need to make it work:

  1. A real iPhone or iPad with the ability to receive push notifications, set up as part of a provisioning profile. The device should be set up to allow push telling for your app to testify up on the lock screen.
  2. Appium set up for existent device testing of iOS apps (see theAppium physicianfor more information). Note that you may have to have a paid Apple developer story to.
  3. Your app as an exported .ipafile, signed and installable on your phone. (Probably best to deploy from Xcode first before run with Appium, to make sure the app can be provision on your device).
  4. Your Apple organization ID, and the appropriate signing certificates, etc ..., (we & # x27; ll need to sign Appium & # x27; s iOS locomotive WebDriverAgent to run on your device too, in addition to your app).
  5. A way to trigger your backend app service to send a push notification to a specific gimmick, based on the device udid, from your test code. This might mean pestering your backend devs to give you an API you can telephone, or a library you can mix in with your codification.

With all this in hand, our examination stream should look like:

  1. Launch an Appium session with our app.
  2. Close out our app, to mimic the experience of a user have a push notification while doing something else.
  3. Trigger the backend service to send a energy notification to the device under test. Ideally this shout should block until the notification has be confirmed sent. (Otherwise, we can run the next step in a loop until successful).
  4. Swipe open the notification shade on the gimmick.
  5. Check the elements on the telling shade for one that matches the content that was sent via the backend service.
  6. Swipe closed the notification tint.
  7. Re-open your app if you want, to verify that the app state has also update in junction with the notification received.
Also read:

Such a flow could look like this in Java:

driver.terminateApp (BUNDLE_ID); // here is where your code should trigger the push notification and look a bit showNotifications (); driver.findElement (By.xpath (`` //XCUIElementTypeCell [contains (@ label, 'notification text ')] '')); hideNotifications (); driver.activateApp (BUNDLE_ID);

The terminateAppand activateAppcommands are self-explanatory, and simply require the bundle ID of your app. The sole mystery hither is in theshowNotificationsand hideNotificationsmethods. These are not driver method, but rather helper methods I & # x27; ve implemented to guide care of swiping the notifications shade down (to open) and up (to shut). The implementation presently uses theTouchActioninterface to set up the swipe. Assuming we have a field calledscreenSizein our trial course which has previously queried the blind property from Appium, then our apprisal helpers appear like:

private void showNotifications () {manageNotifications (true);} private void hideNotifications () {manageNotifications (mistaken);} individual null manageNotifications (Boolean show) {int yMargin = 5; int xMid = screenSize.width / 2; PointOption top = PointOption.point (xMid, yMargin); PointOption bottom = PointOption.point (xMid, screenSize.height - yMargin); TouchAction action = new TouchAction (driver); if (display) {action.press (top);} else {action.press (bottom);} action.waitAction (WaitOptions.waitOptions (Duration.ofSeconds (1))); if (display) {action.moveTo (bottom);} else {action.moveTo (top);} action.perform ();}

Essentially, we hold one method with any real logic, and all it does is set up the appropriateTouchActionactions for a swipe, namely apress, followed by await, followed by amoveTo. There & # x27; s some other logic hither to make certain we & # x27; re fix our offset and halt point correctly: exactly in the middle of the screen horizontally, and from top to fathom (with a padding of 5 pel on either side).

Don ’ t Rely on iOS Emulators & amp; Android Simulators..

That & # x27; s it! With the telling shadow down, we can just regular oldfindElementcommands to locate our arrived telling. In this causa, we use an xpath query based on a part of the label, with text corresponding to what we require to verify in terms of the notification that was received from our backend service.

This tip illustrates an important point about using Appium. Sometimes, we appear for specific features within Appium to help us accomplish our tasks. It would be outstanding, we consider, if Appium had a & quot; getPushNotifications & quot; command we could use to well ascertain whether a telling arrived. But such a command would take us out of the kingdom of UI test. When using Appium, we can simply ask ourselves, & quot; How would a user cheque this? & quot; and more often than not, we & # x27; re capable to do the like thing with Appium. In this cause, the & quot; advanced & quot; trick delineate in this article is actually not a trick at all; it & # x27; s just consider like a exploiter!

Test your mobile apps on real devices in 50+ locations worldwide..

Check out the following codification below for a full example. It won & # x27; t run without adjustment, because due to Apple & # x27; s protection policies around lam apps on existent devices, you & # x27; ll need to kick off the test with your own (signed) app and include your own signing detail and so on. And as always, the code is up at theAppium Pro repoon GitHub:

import io.appium.java_client.AppiumDriver; meaning io.appium.java_client.TouchAction; import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.touch.WaitOptions; import io.appium.java_client.touch.offset.PointOption; import java.net.URL; import java.time.Duration; significance org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.remote.DesiredCapabilities; public class Edition015_Push_Notifications {// these values all postulate to be replaced with your own app which is signed for a real twist, // and a WDA_BUNDLE_ID which works with your wildcard app id private String BUNDLE_ID = `` com.company.yourapp ''; individual String WDA_BUNDLE_ID = `` com.company.webdriveragent ''; private String APP = `` /path/to/yourapp.ipa ''; private String XCODE_ORG_ID = `` ABCDEFG123 ''; private AppiumDriver driver; individual Dimension screenSize; @ Test public nullity testPushNotifications () throws Exception {DesiredCapabilities capabilities = new DesiredCapabilities (); capabilities.setCapability (`` platformName '', `` iOS ''); capabilities.setCapability (`` platformVersion '', `` 11.2 ''); capabilities.setCapability (`` deviceName '', `` iPhone 6s ''); capabilities.setCapability (`` app '', APP); capabilities.setCapability (`` udid '', `` automobile ''); capabilities.setCapability (`` xcodeOrgId '', XCODE_ORG_ID); capabilities.setCapability (`` xcodeSigningId '', `` iPhone Developer ''); capabilities.setCapability (`` updatedWDABundleId '', WDA_BUNDLE_ID); driver = new IOSDriver (new URL (`` http: //localhost:4723/wd/hub ''), potentiality); try {// get screen sizing so we can swipe correctly screenSize = driver.manage () .window () .getSize (); // shut app and wait for push notification to get driver.terminateApp (BUNDLE_ID); // hither is where your code should trigger the pushing notification and wait a bit // now pull down the notification shade, check for the substance we 're expecting, and // so shut the tincture again ('TWITTER ' is just an example of an expected message) showNotifications (); driver.findElement (By.xpath (`` //XCUIElementTypeCell [bear (@ label, 'TWITTER ')] '')); hideNotifications (); // finally, we can reactivate our app in order to control that the message is present, // or whatever we need to do driver.activateApp (BUNDLE_ID);} finally {driver.quit ();}} private void showNotifications () {manageNotifications (true);} individual void hideNotifications () {manageNotifications (false);} private void manageNotifications (Boolean show) {int yMargin = 5; int xMid = screenSize.width / 2; PointOption top = PointOption.point (xMid, yMargin); PointOption bottom = PointOption.point (xMid, screenSize.height - yMargin); TouchAction activeness = new TouchAction (driver); if (display) {action.press (top);} else {action.press (bottom);} action.waitAction (WaitOptions.waitOptions (Duration.ofSeconds (1))); if (show) {action.moveTo (bottom);} else {action.moveTo (top);} action.perform ();}}
Author & # x27; s Profile

Jonathan Lipps

LinkedIn
Author & # x27; s Profile

Piali Mazumdar

Lead, Content Marketing, HeadSpin Inc.

Piali is a active and results-driven Content Marketing Specialist with 8+ years of experience in craft occupy narratives and market collateral across diverse industries. She excel in collaborating with cross-functional teams to germinate innovative content strategies and deliver compelling, authentic, and impactful content that resonates with target audiences and enhances make authenticity.

LinkedIn

Testing iOS Push Notifications

4 Parts

regression intelligence blog
-

Regression Intelligence virtual guide for advanced exploiter (Part 3)

Coming Soon
Regression Intelligence practical guide for advanced users
-

Regression Intelligence practical guide for advanced user (Part 4)

Coming Soon

Discover how HeadSpin can indue your business with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productivity with faster ontogenesis cycles
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent results
gain better visibility into functional & performance issues
Gain best visibility into functional and execution issues
reduce mean time
Reduce mean time to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate sound, video, and content calibre of experience (QoE) effortlessly
The trusted choice for global endeavor
Adobe
Hargreaves Lansdown
Truecaller
Crazylabs
Nedbank
Numeracle
Veryon
Close

Discover how HeadSpin can empower your job with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, benefit a competitive edge
faster development cycles
Boost developer/QA productivity with quicker development rhythm
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent results
gain better visibility into functional & performance issues
Gain better visibility into functional and performance subject
reduce mean time
Reduce hateful clip to identify/resolve during test, QA, and product
evaluate audio, video & qoe
Evaluate audio, picture, and content quality of experience (QoE) effortlessly
The trusted choice for global enterprises
Close

Discover how HeadSpin can empower your business with superior examine capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productivity with faster ontogenesis round
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent result
gain better visibility into functional & performance issues
Gain better visibility into functional and execution issues
reduce mean time
Reduce mean clip to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate audio, video, and content quality of experience (QoE) effortlessly
The trusted pick for global enterprises
Close

Connet Now

Wipro LogoVMLYR Logo
Close
Book a Meeting
Products
footer down arrow
Solutions
footer down arrow
Industries
footer down arrow
Features
footer down arrow
Support
footer down arrow
Resource Center
footer down arrow
Why Choose HeadSpin?
footer down arrow
Copyright © 2026 HeadSpin, Inc. All Rights Reserved.

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free