JetLobster ruby local APNs testing tool

published in iOS Development, Tutorials
by Slawomir Onyszko

Are you working on an iOS mobile app and have to check if all of the programmed notifications work correctly? Keep on reading: JetLobster ruby local APNs tool can easily test the service of notifications in your iPhone app.

Testing the notification service isn’t difficult. Although, in our case, it happened to be impossible. Why? Functionalities on the back-end side weren’t ready yet, and that’s why we needed a tool that would help us send real notifications in a quick and easy way.

How did I make JetLobster ruby local APNs testing tool?

I came up with an idea to write a ruby script which will make it possible. The main goal was to make everything work efficiently and flexibly. Creating the script took me only a few minutes. To send notifications to APNs, I’ve used a gem called APNS – it happened to be easy and at the same time, it provided everything that I needed. Additionally, I’ve used the OptionParser gem to parse parameters in a terminal. Thanks to that the tool became more functional and user-friendly.

Next steps of testing the notifications

To send the notification I needed an application with configurated APNs services, generated *.pem file and the tool’s token (that I’ve managed to get after registering the service). The script requires ruby and bundler. After cloning a repository, it was needed to move on to a directory and run bundle install command. All that had to be done, was to run the script with a minimum of 3 parameters.

ruby jet_lobster.rb --pem "PathToYourPemFile.pem"  
--token DEADC00FE --message "JetLobster is awesome!"

With the --pem option I gave a path to our pem file, --token. Here I’ve provided tool’s token, and in --message, a notification message. In the above command, I didn’t use --other option – but if used, it helps to send an extra data that is placed in a notification. Exemplary:

ruby jet_lobster.rb --pem "PathToYourPemFile.pem" 
--token DEADC00FE --message "JetLobster is awesome!" 
--other "{:sent => 'with JetLobster'}"

Remember that when providing the data, you must use ruby syntax creating Hash.

And that’s it. In my opinion, JetLobster ruby local APNs is an easy, quick and flexible tool to test the service of notification in an iOS app.  And how do you like it?


You can find the source code on my Github.


 

Slawomir Onyszko Mobile Developer

Sławek is our mobile developer who mostly takes care of creating Android applications. He is constantly enhancing his skills of advanced Android app development and he wants to share this knowledge via Zaven’s blog. In his spare time Sławek enjoys watching a good movie at the cinema.

Popular posts

BDD frameworks (part 3)

BDD frameworks (part 3)

In this series of articles, I am presenting selected BDD testing tools. In this part, I will talk about Spock – a unit testing framework.

Read more
BDD frameworks (part 2)

BDD frameworks (part 2)

In this series of articles, you can learn how to use automated software testing with Behavior-Driven Development. In part 1, I described the main assumptions of the process. Now it is time for BDD testing tools.

Read more
BDD frameworks (part 1)

BDD frameworks (part 1)

Programmer, tester, manager, client – mutual understanding between these people is essential for the positive completion of any mobile application programming project. Nobody said it would be easy, but BDD frameworks can help.

Read more
Mobile Apps

Get your mobile app in 3 easy steps!

1

Spec out

with the help of our
business analyst

2

Develop

design, implement
and test, repeat!

3

Publish

get your app out
to the stores


back to top