logo logo

Simulating Slow Network Connection For Testing

Simulating Slow Network Connection For Testing

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 🌐

Slow Internet Meme
Source: imgflip.com

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 

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.

Google Chrome and Microsoft Edge

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:

Google Chrome throttling
Google Chrome throttling options

You can even choose to go offline or create your custom throttling settings:

Custom network profile
Custom network profile

Microsoft Edge has the exact same options as Google Chrome, so no need to get into more details.

Mozilla Firefox

Things are pretty much the same in Firefox, with some extra default options:

Firefox Connection

You can read the characteristics of each of these options on their official website.

Using Extensions

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):

testing slow connection: URL Throttler for Chrome

Simulating a slow Internet connection for desktop apps

Using Fiddler

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:

Customize Rules in Fiddler

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.

Delay request and response time in Fiddler

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:

Slow Network Connection: Simulate Slow Connection in Fiddler

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.

Using Clumsy

Clumsy is another nice free app, that lets you simulate various network problems that can help your testing:

Slow Network Connection: Clumsy

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.

Simulating a slow Internet connection for mobile testing

Android 

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 📲

iOS

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:

Slow Network Connection: Network Link Conditioner
Source: https://nshipster.com/

Using Android Virtual Device Manager (AVD)

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:

AVD Network Connection

Then, restart your device and start testing!

Conclusion

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 🔽

About the author

Andreea Draniceanu

Andreea is a QA engineer, experienced in web and desktop applications, and always looking to improve her automation skills and knowledge. Her current focus is automation testing with C#.

Comments

6 1 comment

Leave a Reply

FacebookLinkedInTwitterEmail