Simulate network conditions
BrowserStack App Automate enables you to test mobile apps under various network conditions such as offline mode, airplane mode, and network profiles such as 3g-umts-good, 4g-lte-good, etc on BrowserStack’s real mobile device cloud.
To simulate network conditions, you can use any of our pre-defined network profiles or create a custom one. In this guide, you will learn how to:
- Simulate device offline and airplane mode
- Simulate network conditions using pre-defined network profiles
- Simulate network conditions using a custom network profile
Simulate device offline and airplane mode
To simulate device offline or airplane mode, use the following network profiles :
Profile Name | Description |
---|---|
no-network |
Disables network settings to send device offline |
airplane-mode |
Turns on Airplane mode setting on the device |
Use the following REST API endpoint with appropriate networkProfile
parameter value :
POST /app-automate/espresso/v2/build
Example:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/build" \
-d '{"networkProfile": "no-network", "devices": ["Samsung Galaxy S8-7.0"], "app": "bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", "testSuite": "bs://e994db8333e32a5863938666c3c3491e778352ff"}' \
-H "Content-Type: application/json"
The no-network
and airplane-mode
profiles are not supported on a few Android devices. For a detailed list of unsupported devices, see networkProfile. However, you can use no-network
profile to simulate airplane mode on Android.
Simulate network conditions using pre-defined network profiles
To simulate various network conditions such as 3G, 4G, etc, use any of the following pre-defined network profiles :
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 |
Use the following REST API endpoint with appropriate networkProfile
parameter value :
POST /app-automate/espresso/v2/build
Example:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/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, create a custom network profile using the following parameters :
- Download speed (kbps)
- Upload speed (kbps)
- Latency (ms)
- Packet loss (%)
Use the following REST API endpoint with appropriate customNetwork
parameter value :
POST /app-automate/espresso/v2/build
Example :
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/build" \
-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 only available with a BrowserStack Paid plan. View details.
Need some help?
If you have any queries, please 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!