Skip to main content

Network Throttling

Real Devices Only

With Sauce Labs Network Throttling, you can simulate and reproduce different network scenarios on iOS and Android, ensuring that your mobile application performs optimally under a huge variety of network conditions. From replicating slow network speeds to mimicking offline states, high latency, or connection disruptions, this feature allows you to identify network-related performance issues early in your pipeline.

In combination with our Network Traffic Capture functionality to record network traffic, you have the tools to replicate and troubleshoot any performance concerns stemming from network operations.

What You'll Need

  • A Sauce Labs paid account (Log in)
  • Access to our Real Devices (iOS/Android)

Supported Network Conditions

The following table shows the allowed range of supported network condition parameters:

Network ConditionParameterRange
Download speeddownloadSpeed0 - 50000 kbps
Upload speeduploadSpeed0 - 50000 kbps
Latencylatency0 - 3000 ms
Packet lossloss0 - 100 %

Only specified parameters will undergo conditioning, allowing for flexibility in customizing network simulations to your precise testing needs.

Predefined Network Profiles

The following table shows the predefined network profiles along with their corresponding parameter values supported on Sauce Labs:

Network ProfileIDDownload Speed (kbps)Upload Speed (kbps)Latency (ms)Packet Loss (%)
No Throttlingno-throttling----
No Networkno-network000100
2G Packet Loss2G-packet-loss1005050010
2G2G2001003001
3G Slow3G-slow5002502001
3G Fast3G-fast70002500100-
4G Slow4G-slow80004000100-
4G Fast4G-fast250001500030-

Automated Testing

Appium - Capability

To use the Sauce Labs Network Throttling feature in your automated Appium test, you can add the Sauce-specific capability networkConditions to provide custom network conditions for the entire session. Alternatively, you can use the Sauce-specific capability networkProfile to apply one of the predefined network profiles to your session.

MutableCapabilities capabilities = new MutableCapabilities();
//...
MutableCapabilities sauceOptions = new MutableCapabilities();

// network conditions
sauceOptions.setCapability("networkConditions", ImmutableMap.of(
"downloadSpeed", 5000,
"uploadSpeed", 3000,
"latency", 200,
"loss", 2,
));

// OR

// network profile
sauceOptions.setCapability("networkProfile", "2G");

capabilities.setCapability("sauce:options", sauceOptions);

Appium - executeScript

To change your desired network conditions dynamically any time during your automated Appium test, use our Sauce-specific scripts sauce: network-conditions and sauce: network-profile with Appium's Execute Script.

Dynamically set Network Conditions
driver.executeScript("sauce: network-conditions", ImmutableMap.of(
"downloadSpeed", 5000,
"uploadSpeed", 3000,
"latency", 200,
"loss", 2,
));
Dynamically set a Network Profile
driver.executeScript("sauce: network-profile", "4G-fast");

To disable network throttling, use the predefined network profile no-throttling:

driver.executeScript("sauce: network-profile", "no-throttling");

Live Testing

Apply network throttling dynamically to your manual Live tests by selecting a predefined profile or by providing network conditions.

  1. In the live test window, in the left toolbar, click Throttle Network to open the network throttling tool.
Throttle Network tool
  1. Select a predefined profile from the dropdown to start the network throttling.
Throttle Network profile selection

An active network throttling is indicated by the pulsing red dot on the top left of the Throttle Network tool.

Throttle Network profile selection
  1. Click on the pulsing red dot to pause the network throttling. A paused throttling is indicated by the pause icon.
Throttle Network profile selection

Upcoming

  • Apply network throttling to your native Espresso and XCUITest tests

Limitations

Limitations
  • iOS network throttling is supported on iOS/iPadOS 14.0 and above.
  • Android network throttling is supported on Android 10 and above.

More Information