DEV Community

Cover image for 7 ways to Simulate Low Network Speed to Test Your Mobile Application
Fora Soft
Fora Soft

Posted on • Updated on • Originally published at forasoft.com

7 ways to Simulate Low Network Speed to Test Your Mobile Application

When testing mobile apps, newbies QA frequently forget to check the app with an unstable Internet connection. But in many cases this is critical: connection speed directly influences user experience and workability of the main functions. It is especially true for applications where geolocation and mobile Internet are heavily in use. For example, video chats, messengers, and other multimedia products we specialize in.

In this article, we’ll show how to simulate slow Internet connection on a test device with no hassle.

Network Link Conditioner

Let’s start with a standard utility Network Link Conditioner for iOS apps testing. It lets the QA adjust the Internet connection as they need.

To switch on this function on iPhone, you need a MacOS device:

  1. Download and install Xcode for Mac
  2. Open Xcode on Mac
  3. Connect iPhone to Mac
  4. Allow Mac access iPhone
  5. Open Settings on iPhone
  6. Scroll down
  7. Tap Developer

iPhone settings

  • Tap Network Link Conditioner

Developer section setting options

  • Pick network preset or create your own
  • Switch on the Enable toggle

Enable toggle in Network Link Conditioner

iOS lets us choose one of pre-installed presets of connection quality – or create our own preset.

For our own preset these settings are available:

Settings for preset connection quality

Here we see that Apple took care of testing apps with different levels of connection quality and gave us almost all the needed settings.

Having got acquainted with Network Link Conditioner for iOS, we’ve been sure such a feature would be on Android too. God, how much we’ve been mistaken.

Network Link Conditioner on Android

It appeared to be impossible to emulate a slow or unstable connection on a real Android with the help of standard tools. Therefore, I faced 2 paths: download some apps from Google Play that emulate slow connection, or use a specifically precise adjustment of the Internet connection access point.

Apps didn’t work out for me ☹ All the apps that give this function require Root access, and this breaks the concept of testing in real-world conditions.

So, having left the Root access as the last resort, I decided to look closer at path #2 — adjustment of the access point.

In the past, when I was a student, mobile internet traffic was ending up quickly (and we needed to read, watch something while on the lesson), and we used an iPhone as an access point. The idea came to mind: to mix the student experience and recently gathered knowledge.

Using Network Link Conditioner and an access point made of macOS or iOS doesn’t require any extra knowledge and are easy to adjust. Exactly what’s needed if we want to save time.

So, to emulate bad connection on Android we need and Android device and… an iPhone with mobile internet Developer Tools switched on.

  1. Make iPhone the access point (Settings > Mobile Data > Personal Hotspot)
  2. Adjust connection with Network Link Conditioner
  3. Connect to the access point with the Android device
  4. Ready. You’re awesome 🙂

Cloud device farms

You don’t have to own a device farm to test an app on a wide range of mobile devices. It’s also quite inconvenient if you or your employees mostly work remotely. We started using cloud device farms, and let us tell you — it’s a big gamechanger. You should try it for better mobile testing.

Some farms (e.g. Browserstack or LambdaTest) allow connection throttling — artificial connection slowdown — for testing on mobile devices.

Throttling options on Browserstack

It might require a paid subscription to throttle the connection. For Browserstack the individual plan price starts from $29.

Android emulator testing

Another way to simulate slow connection is to use an emulator. It’s software for a PC that copies another OS. Android emulator imitates the performance of a real smartphone, so you can test your mobile app on it if you don’t have an actual device.

Testing on emulators could never compare to testing on real devices but it’ll do for the first development stages.

With Android studio emulators you can set the limit based on the cellular type (LTE, EDGE, etc.). Each type has its own speed limitations (in kbps):

gsm — GSM/CSD (up: 14.4, down: 14.4)
hscsd — HSCSD (up: 14.4, down: 57.6)
grps — GRPS (up: 28.8, down: 57.6)
edge — EDGE/EGPRS (up: 473.6, down: 473.6)
umts — UMTS/3G (up: 384.0, down: 384.0)
hsdpa — HSDPA(up: 5760.0, down: 13,980.0)
lte — LTE (up: 58,000, down: 173,000)
evdo — EVDO (up: 75,000, down: 280,000)
full — No limit, the default (up: 0.0, down: 0.0)

How to test an app on Android emulator with throttled connection?

  1. Download Android Studio

  2. Create an emulator using Android Virtual Device Manager

  3. When creating / editing the emulator pick the cellular type:

  • Tap Show advanced settings

Advanced Settings in Android Studio

  • Select speed in the Network section

Picking the Speed in the Network section

  • Run the emulator
  • Launch your app in the emulator
  • Turn off the WiFi on the emulator for it to use cellular connection settings

Changing cellular type in the device settings

You can pick a certain cellular type on an actual Android or iOS device. To do that you’ll also need a SIM-card with Internet access.

How to switch to another network on an Android device?

  1. Go to Settings
  2. Then _Network & Internet _
  3. Open Internet
  4. Go to SIM settings
  5. Tap Preferred network type

Instruction on how to switch cellular types on Android

Works for Android 12. Section names and placings may differ depending on the device and OS version.

How to switch to another network on an iOS device?

  1. Go to Settings
  2. Then to Mobile Data
  3. Open Mobile Data Options
  4. Tap Voice & Data

Instruction on how to switch cellular types on iOS

Works for iOS 15.

Bandwidth throttling in web debugging tool Charles

If cloud farms are expensive, launching an emulator is complicated, and you don’t have any SIM, you can use the network throttling function in Charles.

Basically, you can use Charles to keep track of the mobile devices traffic when you carry out functional testing or debugging. But you can also use it to simulate slow internet connection for testing.

How to imitate slow connection with Charles?

  1. Setup your host machine with Charles installed as a proxy for the device and the app you’re testing. Learn more about it from the Charles documentation.
  2. When in Charles go to Proxy > Throttle settings
  3. Tap Enable Throttling
  4. Select the speed limitation preset or set it up manually
  5. Save the settings
  6. Click Proxy > Start throttling

How to start throttling on Charles

Throttling the speed in the router settings

You can also go for a radical way and throttle the speed in your router settings. It will definitely work if you test your app at home, on a real device, and you have access to the router admin panel. Keep in mind that having such an option depends on the router.

How to throttle the connection on a router?

  1. Go to the router settings. To do that, enter the special URL or the router IP in the address bar of your browser (192.168.1.1 or 192.168.0.1)
  2. Enter login and password. You can find them on the router itself (usually both are “admin” by default)
  3. Open the Bandwidth control section

What a standard Admin panel looks like

Don’t forget to cancel the limitation once you’re done 🙂

Conclusion

There’re many ways to test an app and fake bad internet connection. The most convenient one, at least for us, is Network Link Conditioner. But you’re free to choose the best for yourself.

Tested everything, it all worked out? Don’t forget to report on it 🙂

Top comments (0)