Simulate device modes and network conditions
Simulate different network conditions such as bandwidth, latency, and packet loss for your Flutter test executions on BrowserStack App Automate.
BrowserStack App Automate allows you to test mobile apps under different network conditions, including offline mode, airplane mode, and network profiles like 3G-UMTS-Good, 4G-LTE-Good, and more, on BrowserStack’s actual mobile device cloud.
To simulate network conditions, choose from our predefined network profiles or create a custom network profile. You need to set the networkProfile or customNetwork parameter in the builds REST API (Android or iOS) when starting your Flutter integration test.
| Parameter | Description | Value |
|---|---|---|
networkProfile |
Simulate different network conditions from the list of existing network profiles |
<profile-name> Example: 2g-gprs-good, 2g-gprs-lossy, 3g-umts-good etc. |
| Parameter | Description | Value |
|---|---|---|
customNetwork |
Simulate a custom network condition | download speed (kbps), upload speed (kbps), latency (ms), packet loss (%) E.g. “1000, 1000, 100, 1” |
Simulate device modes and network conditions using pre-defined profiles
The networkProfile parameter enables you to simulate a device mode and specific network conditions.
To simulate the offline or airplane mode on a device, set networkProfile to no-network or airplane-mode:
| Profile Name | Description |
|---|---|
no-network |
Disables network settings to set the device offline. |
airplane-mode |
Turns on the Airplane mode setting on the device. |
Example cURL request to simulate the device offline mode:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/flutter-integration-tests/v2/android/build" \
-d '{"networkProfile": "no-network", "devices": ["Samsung Galaxy S8-7.0"], "app": "bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", "testSuite": "bs://e994db8333e32a5863938666c3c3491e778352ff"}' \
-H "Content-Type: application/json"
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/flutter-integration-tests/v2/ios/build" \
-d '{"networkProfile": "no-network", "devices": ["iPhone 14 Plus-16"],"testPackage": "bs://ab001d58695f23f0ee925ad7e3126015e5846ca8"}' \
-H "Content-Type: application/json"
To simulate a specific network condition, set networkProfile to the relevant profile name from the table given here. For example, if you want to simulate a condition in which bandwidth in/out is 50/30 kbps, latency is 500 ms, and packet loss is 1%, set networkProfile to 2g-gprs-good.
| Profile Name | Bandwidth in/out (Kbps) | Latency (ms) | Packet Loss (%) |
|---|---|---|---|
| 2g-gprs-good | 50/30 | 500 | 1 |
| 2g-gprs-lossy | 30/20 | 650 | 2 |
| edge-good | 250/150 | 300 | 0 |
| edge-lossy | 150/100 | 500 | 1 |
| 3g-umts-good | 400/100 | 100 | 0 |
| 3g-umts-lossy | 200/50 | 200 | 1 |
| 3.5g-hspa-good | 1800/400 | 100 | 0 |
| 3.5g-hspa-lossy | 900/200 | 190 | 1 |
| 3.5g-hspa-plus-good | 7000/1500 | 100 | 0 |
| 3.5g-hspa-plus-lossy | 2000/600 | 130 | 1 |
| 4g-lte-good | 18000/9000 | 100 | 0 |
| 4g-lte-high-latency | 18000/9000 | 3000 | 0 |
| 4g-lte-lossy | 7000/3000 | 120 | 1 |
| 4g-lte-advanced-good | 25000/18000 | 80 | 0 |
| 4g-lte-advanced-lossy | 15000/10000 | 70 | 1 |
| reset | Set network settings to BrowserStack’s default configuration | N/A | N/A |
Example cURL request to simulate network conditions using pre-defined network profiles:
Simulate network conditions using a custom network profile
To simulate a custom network condition, specify the download speed, the upload speed, latency, and packet loss, in that order, as values for the customNetwork parameter. For details, see the following table:
| Profile | Description |
|---|---|
| Download speed (kbps) | Indicates the rate at which the device can retrieve data from the network, with higher values indicating faster download speeds, simulating quicker connections. |
| Upload speed (kbps) | Represents the rate at which the device can send data from the device to the network, allowing for the adjustment of various upload speed scenarios. |
| Latency (ms) | Measures the delay between the device sending a request and receiving a response, with higher latency values simulating delays similar to real-world conditions. |
| Packet loss (%) | Allows for the simulation of data packet loss within the network, mimicking real-world scenarios. Adjusting this percentage assesses performance under adverse conditions. |
By configuring these parameters in your custom network profile, you can test how your app behaves under network conditions close to what your users encounter in the real world.
Example cURL request to simulate custom network condition:
Network profile and custom network features for app testing are exclusively available with a paid BrowserStack plan. See our pricing plans for more details.
Related topics
-
Manage your uploaded apps or test packages using our REST API (Android or iOS).
-
Use the list recent builds API (Android or iOS) to list your recently uploaded apps.
-
Delete your uploaded apps or test packages using the delete API endpoint (Android or iOS).
-
If you have any queries, get in touch with us.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!