Simulate device modes and network conditions
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 when starting your Flutter integration test.
REST API endpoint:
POST /app-automate/flutter-integration-tests/v2/builds
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"
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 |
Example cURL
request to simulate network conditions using pre-defined network profiles:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/flutter-integration-tests/v2/android/build" \
-d '{"networkProfile": "3g-umts-good", "devices": ["Samsung Galaxy S8-7.0"], "app": "bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", "testSuite": "bs://e994db8333e32a5863938666c3c3491e778352ff"}' \
-H "Content-Type: application/json"
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 within your custom network profile, you can precisely emulate diverse network environments, facilitating effective testing and optimization of your applications and services under different conditions. This level of control ensures that your product remains robust and reliable, regardless of the network challenges it may encounter in the real world.
Example cURL request to simulate custom network condition:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/flutter-integration-tests/v2/builds" \
-d '{"customNetwork": "1000, 1000, 100, 1", "devices": ["Samsung Galaxy S8-7.0"], "app": "bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", "testSuite": "bs://e994db8333e32a5863938666c3c3491e778352ff"}' \
-H "Content-Type: application/json"
Network profile and custom network features for app testing are exclusively available with a paid BrowserStack plan. You can view more details on pricing here.
Related topics
-
Manage your uploaded apps using our REST API.
-
Use the recent apps API endpoint to list your recently uploaded apps.
-
Delete your uploaded apps using the delete app API endpoint.
-
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!