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/xcuitest/v2/build
Example:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/build" \
-d '{"networkProfile": "no-network", "devices": ["iPhone 8 Plus-11.0"], "app": "bs://f5L3azt9pLzE995f49376eb1fa3c284dc321f8d", "testSuite": "bs://6eb1fa3c284ddbe9971b2d1aee0d52943b9c081"}' \
-H "Content-Type: application/json"
-
no-network
profile is only supported on iPhones with iOS 11 & above. -
airplane-mode
profile is not supported on iOS. However, you can useno-network
profile to simulate airplane mode on iOS.
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/xcuitest/v2/build
Example:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/build" \
-d '{"networkProfile": "3g-umts-good, "devices": ["iPhone 8 Plus-11.0"], "app": "bs://f5L3azt9pLzE995f49376eb1fa3c284dc321f8d", "testSuite": "bs://6eb1fa3c284ddbe9971b2d1aee0d52943b9c081"}' \
-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/xcuitest/v2/build" \
-d '{"customNetwork": "1000, 1000, 100, 1", "devices": ["iPhone 8 Plus-11.0"], "app": "bs://f5L3azt9pLzE995f49376eb1fa3c284dc321f8d", "testSuite": "bs://6eb1fa3c284ddbe9971b2d1aee0d52943b9c081"}' \
-H "Content-Type: application/json"
Related topics
-
Manage your uploaded app or test suite using our upload app REST API and upload test suite REST API.
-
Use the get app API endpoint and list test suites API endpoint to list your recently uploaded apps and test suites.
-
Delete your uploaded app or test suite using the delete app API endpoint and delete test suite API endpoint.
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!