Shane11
Shane11

Reputation: 136

Automated Push Notification Testing with XCTest

I'm attempting to automate the testing of my push notifications using XCTest and Continuous Integration with Xcode Server.

As far as I can tell, I have correctly configured my push notifications, as I receive them correctly when the app is running. The issue is, when I run a test (even on a physical device) I don't receive the notification. I have confirmed on both the sending device as well as the backend that the push notification has been sent. As far as I know, you cannot receive push notifications on iOS simulators, but I am running the test on an actual device, so I was assuming this would be different.

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

Thanks for the help.

Upvotes: 7

Views: 2142

Answers (1)

brigadir
brigadir

Reputation: 6942

While there is no way to deal with PNs on Simulator with Apple-provided instruments, there is magic 3-rd party toolset to help on it:

https://github.com/acoomans/SimulatorRemoteNotifications

SimulatorRemoteNotifications is a library to send mock remote notifications to the iOS simulator.

The library extends UIApplication by embedding a mini server that listen for UDP packets containing JSON-formated payload, and a service to send notifications to the mini server.

This project includes the iOS Simulator Notifications MacOSX app to help you send the mock notifications.

Upvotes: 0

Related Questions