Test notifications automatically with XCTest

I am trying to automate testing of my push notifications using XCTest and Continuous Integration with Xcode Server.

As far as I can tell, I set up my push notifications correctly, as I receive them correctly when the application is running. The problem is that when I run the test (even on a physical device), I do not receive a notification. I confirmed both on the sending device and on the backend, which was sent by push notification. As far as I know, you cannot receive push notifications on iOS simulators, but I run the test on a real device, so I assumed that it would be different.

Obviously, I can check manually to see if the information is compatible through the sending device, backend, and receiving device, but I was hoping to automate the whole process.

Thanks for the help.

+6
source share
1 answer

While there is no way to deal with PN on the Simulator with tools supplied by Apple, there is a magical 3rd party toolkit that will help him:

https://github.com/acoomans/SimulatorRemoteNotifications

SimulatorRemoteNotifications is a library for sending remote notifications to an iOS simulator.

The library extends UIApplication by embedding a mini-server that listens for UDP packets containing a JSON-formatted payload and a service for sending notifications to the mini-server.

This project includes the MacOSX iOS Simulator Notification App to help you send error notifications.

0
source

All Articles