The software industry is becoming more competitive each day, so software developers need to make sure that their apps are the most appealing to the users. As testers, we are in charge of checking how the application works in various conditions.
And even if we probably have high-performing setups in our workplace, and a good Internet connection should be mandatory for the job, it’s also important to check how our applications behave in not-so-ideal conditions – i.e. when the users have a slow network connection 🌐
So how do we get started? First off, we will of course need different approaches depending on the type of application we are using.
Table of Contents
- Simulating a slow Internet connection from the browser
- Simulating a slow Internet connection for desktop apps
- Simulating a slow Internet connection for mobile testing
Let’s start with one of the most common types of testing: web testing. Ideally, cross-browser testing should be performed, to validate that our app behaves right in all the popular browsers. If we want to test a slow connection on the web, we can use Developer Tools, which are available in all the major browsers.
To access the Developer Tools, simply go to the browser’s menu, select More Tools, and Developer Tools for Google Chrome and Microsoft Edge, or Web Developer Tools if using Mozilla Firefox 🔨 This will open up a pane on the side of the browser window. From here, the settings will slightly vary depending on the browser, but the principle is the same.
Let’s start with Chrome because it’s the most popular browser at the time I’m writing the article. Go to the Network tab of the Developer Tools. Here, you should see a drop-down that says “No throttling“. This is the default option used, and it simply means that when we navigate the web, we are using our normal network connection. If you expand the dropdown, you will see the other predefined options provided by Chrome:
You can even choose to go offline or create your custom throttling settings:
Microsoft Edge has the exact same options as Google Chrome, so no need to get into more details.
Things are pretty much the same in Firefox, with some extra default options:
You can read the characteristics of each of these options on their official website.
There are also extensions that you can add to your browser which can simulate various network settings. A good example is URL Throttler for Chrome. It allows you to add a customized delay to certain web pages (you can use regular expressions to define which pages the delay should apply to):
This is a fun one 😁 Since desktop applications are stand-alone, they probably don’t have any specific settings, we need some outside help. Here’s where Fiddler comes in. If you’re not familiar with it, let me give you a quick review. It’s a debugging proxy server tool used that helps with logging, inspecting, and modifying HTTP requests. It works on Windows, Linux, and Mac OS.
Another good thing Fiddler can do is to simulate a slow connection. For that, do the following steps:
Open the Rules menu, and select Customize Rules:
This will open up the FiddlerScript Rules files in an editor. Inside the editor, there is a condition
if (m_SimulateModem) which is what we want to do – i.e. simulate a modem.
You can see there are two values: one for delaying the request, and one for delaying the response. We can adjust both values as needed. After that, save the file and close it.
Keep in mind that the condition that verifies if we are simulating a modem is still false, so the delays won’t happen yet. To make it true, expand the Rules menu again, and select Performance -> Simulate Modem Speeds:
From now on, all requests and responses will be delayed, so you can see how your application behaves when it takes longer to send or receive information. Remember to disable the option and/or close Fiddler once you are done with your tests, so you can use your regular network connection.
Clumsy is another nice free app, that lets you simulate various network problems that can help your testing:
You can download it from this link, and then select what you want it to do. It’s easier to use than Fiddler, but the bad news is that it only works on Windows.
There are some Android devices that have settings that allow you to only use 2G connections. This is a good start, but sadly, it’s not available on all devices. As a Windows user, you can use the above-mentioned Clumsy app to slow down your connection, then create a mobile hotspot from your PC, and connect the mobile device you are testing to that hotspot 📲
For iOS devices, you can simulate a slow network connection from the Developer Settings. However, you need to install XCode, which means you also need to own a Mac computer.
After you install it, you need to connect your device to XCode, and access the Developer Settings on the phone or tablet from the Settings menu. From here, choose Network Link Conditioner, which gives you a series of settings, including the option to add your own customized profile:
If using an emulated device on AVD, you can access its configuration, and from here, in the Advanced Settings, change the Speed and/or Latency values under Network:
Then, restart your device and start testing!
It’s important to know that the applications we are testing don’t have any unexpected failures when used with slower connectivity. And it’s also good to know that we don’t need to go far away looking for a bad reception to test that 😅 Whether you’re doing web, mobile, or desktop testing, there are ways to simulate the slow Internet connection you need to execute your tests.
Let me know in the comments if you have other tips on how to achieve a slow connection for testing 🔽