Join the webinar on ‘Real-time Smart Alerts for Quick Issue Detection and Resolution’ on Dec 3rd.
Close
Simulating Slow Internet Connections on Android EmulatorsSimulating Slow Internet Connections on Android Emulators

Simulating Slow Internet Connections on Android Emulators with Appium

June 5, 2019
 by 
 Jonathan Lipps Jonathan Lipps
Jonathan Lipps

Ensuring that software works for non-ideal cases is much more work than programming the happy-path behavior, and is perhaps more critical. Since app developers need to ensure apps work in all situations, app testers must test these situations too!

Check out: Test Native Apps with Real Device Cloud

While worldwide cellular networks are growing and improving, even in the most developed cities you will encounter bad network connections throughout the day. Appium has the ability to adjust the network connectivity of Android Emulators with a simple desired capability:


DesiredCapabilities caps = new DesiredCapabilities();
// ... regular desired capabilities
caps.setCapability("networkSpeed", "lte");
Driving 5G applications across industries using HeadSpin. Learn more.

The networkSpeed desired capability will change the upload and download speed accessible to the emulator. The following values can be set, all speeds are in kbps:

  • gsm - GSM/CSD (up: 14.4, down: 14.4).
  • scsd - HSCSD (up: 14.4, down: 57.6).
  • gprs - GPRS (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).

This desired capability will work, even if the emulator has already been launched, prior to the test being run.

Test your apps on real devices and get accurate results. Learn more.

If you start the emulators using Appium, you can also control the latency of the emulator network connection. This can be done by specifying an extra argument to be used when starting the emulator. In this case, the -netdelay argument, which can be used via the avdAgrs desired capability. More information on the -netdelay option can be found here: https://developer.android.com/studio/run/emulator-commandline.

That's it for this week, we're busily preparing for AppiumConf 2019 and hope to see you there!

Share this

Simulating Slow Internet Connections on Android Emulators with Appium

4 Parts