Automating deeplinks with iOS using iMessages

In OpenSooq, delivering a high-quality product is of utmost importance. To accomplish this goal, we use automated testing to catch bugs before they reach our users. One of the challenges that we face every release is testing deep linking.

The main goal of clicking on notification by users is getting the content they want to see. However, the internal process should handle the notification and the deep link inside this notification.  On Others hand, clicking on Add post notification should redirect the user to Add post screen inside the app. The challenge comes from handling the notification and deep link that relates this notification to our app.  At the end of the day, iOS is just responsible for launching your app with the bundle that has the tag for you to know which screen/action you should redirect the user to.

OpenSooq is evolving rapidly adding new features every release, changing the designs to keep up to date to the market requirements. Most of these features have deep links to it. So, the problem of tackling the notification handling rises up, especially that we have UI changes on every release that it can break one or two deep links.

Imagine if you need to test 80 deep links and each one needs ~3 mins to test manually. So, the total of testing will become 4 hours, and this is a waste of tester time.  Testing them manually is like transferring the sea water to another sea in a spoon.


The Definition of Deep Linking?
You have for sure noticed that when you click on a link, or even push notifications, you will be redirected to the app that is associated with this link, rather than opening a web page. This behavior occurs only because this app supports deep links. Deep links will direct you to a specific item or piece of content within the app itself (considering app exists). Without the use of a deep link, you would be redirected to the app’s webpage or homepage.

The importance of deep links in apps, unlike webpages, is increasing since apps do not all share a resource navigation standard such as HTTP and URL. Each app has a different scheme, and this communication gap between apps can be bridged using a Uniform Resource Identifier (URI). Example: your-app-scheme://data=abc.

The Story of Deep Links with OpenSooq
As we said earlier, changes in code from the iOS developer or the backend side can affect a deep link’s ability to behave correctly. Testing each deep link manually would be tiresome and time-consuming. Instead, we have found a way to implement an automation test for all deep links using the “User Interface Testing” feature in Xcode and the iMessage App! Yes, the iMessage App can in fact help us to accomplish this mission. The process of how this is actually done will be presented below.

Steps:

1- From “Test Navigator” in Xcode create “New UI Test Target”, Your file will look like this:

2- Add iMessage App necessary functions to the same class so your Test file can reach iMessage app.

3- Add test methods and cases to the class that you created.

Now from “Test Navigator” you can run the case you want.

Or you can run them all at the same time.

Once you run your test it will look like this:

Xcode will till you which test passed and which one failed.

Thats it! Now all what you need to do is add your new test cases before go with any release and run them, You no longer need to do any additional work.

Leave a reply:

Your email address will not be published.

Site Footer

@ OpenSooq 2019