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:
- Download and install Xcode for Mac
- Open Xcode on Mac
- Connect iPhone to Mac
- Allow Mac access iPhone
- Open Settings on iPhone
- Scroll down
- Tap Developer
- Tap Network Link Conditioner
- Pick network preset or create your own
- Switch on the Enable toggle
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:
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.
- Make iPhone the access point (Settings > Mobile Data > Personal Hotspot)
- Adjust connection with Network Link Conditioner
- Connect to the access point with the Android device
- 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.
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
- Select speed in the Network section
4. Run the emulator
5. Launch your app in the emulator
6. 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?
- Go to Settings
- Then Network & Internet
- Open Internet
- Go to SIM settings
- Tap Preferred network type
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?
- Go to Settings
- Then to Mobile Data
- Open Mobile Data Options
- Tap Voice & Data
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?
- 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.
- When in Charles go to Proxy > Throttle settings
- Tap Enable Throttling
- Select the speed limitation preset or set it up manually
- Save the settings
- Click Proxy > Start throttling
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?
- 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)
- Enter login and password. You can find them on the router itself (usually both are “admin” by default)
- Open the Bandwidth control section
Don’t forget to cancel the limitation once you’re done 🙂
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 🙂