Use Network Link Conditioner When Testing Your App

Yogev Sitton
Feb 21, 2016 · 3 min read
Network Link Conditioner

One thing that is often being over looked when putting an app through QA is working with different variations of quality of the device’s internet connection. Usually the QA makes sure everything works as it should, then turns off WiFi, turns on Airplane Mode and makes sure the app knows how to handle “no internet”.

Developers need to support both cases so apps won’t just crash when trying to query an unreachable server. You can decide on a set of features that is available for offline mode and another set that is restricted to online mode only. You can also decide to block the use of the app altogether in case of no internet.

Unfortunately for us mobile developers — these are not the only two states of an app. Most of your users will be using 3G or 4G in one point or another while interacting with your app instead of the more (usually) stable WiFi. Connection speed and quality may vary.

It’s easy to imagine cases where a user is using your app while driving. What will happen if the road will suddenly go into a tunnel? How will your app handle the sudden connection loss? What if a user enters a building and takes a long elevator? Also — there are cases where the iPhone will think it’s connected to the internet but lose all or most of it’s bandwidth.

Fortunately for us iOS developers — Apple has provided a great tool for just that.

Xcode provides a tool called Network Link Conditioner that can simulate various network conditions, including reduced bandwidth, high latency, DNS delays, packet loss, and so on. Before you ship any software that uses networking, you should install this tool, enable it, then run your software to see how it performs under real-world conditions.

Network Link Conditioner Profiles Management

With Network Link Conditioner it is very easy to check your app still behaves as expected with an unstable/bad connection. It comes with it’s own preset profiles (100% loss, 3G, High Latency DNS, Very Bad Network, etc…) and allows you to make custom profiles of your own.

When turning Network Link Conditioner ON it will affect the connection of your machine. You should remember that. More than once I was frustrated with the sudden slowness of the internet speed in the office — only to remember a few seconds later I was still using Network Link Conditioner.

The fact that your entire machine is affected makes it easy to test your app and check how it handles connection issues in a simulator. While the Network Link Conditioner is turned on a big exclamation mark will be featured on the status bar - helping you remember you are now testing slow internet connection.

Network Link Conditioner on a real device

You can also use Network Link Conditioner on actual devices that have been enabled for development. First, go to the Settings app, search for the Developer section (which will appear only on devices that has been used for development) and then search for the Network Link Conditioner section. TA-DA! Network testing on a real device. Just remember to turn it off when you are done testing.

In order to install Mac OS’s Network Link Conditioner you must first download the Hardware IO Tools for Xcode 7 from this link.

Apple Developer Downloads

Yogev Sitton

Written by

iOS lead at Mint