Overview
BrowserStack App Automate allows you to run your Patrol tests on real Android and iOS devices in the cloud. You can test across different device models, OS versions, and configurations without maintaining physical devices.BrowserStack offers both real devices and emulators/simulators. For the most accurate testing, we recommend using real devices.
Prerequisites
Create BrowserStack account
Sign up for a BrowserStack account if you don’t have one already.
Get your credentials
Retrieve your username and access key from BrowserStack’s account page.
Setup for Android
Update test runner
Modify your app-level build.gradle or build.gradle.kts file to use the BrowserStack-specific test runner:
The
BrowserstackPatrolJUnitRunner is a specialized test runner that integrates with BrowserStack’s infrastructure and provides better test reporting.Setup for iOS
BrowserStack requires tests to use Xcode test plans. Follow these steps to convert your project:Make sure your project name is “Runner” and the scheme is named “Runner” - these are the default names for Flutter projects and are expected by BrowserStack.
Running Tests
You have two options for running tests on BrowserStack: using automated scripts (recommended) or manually via API.- Using Scripts (Recommended)
- Manual API Usage
Install mobile-tools
LeanCode provides convenient scripts (bs_android and bs_ios) for scheduling test runs on BrowserStack. These scripts are part of the mobile-tools package.Install via Homebrew:Configure environment variables
The scripts use theBS_CREDENTIALS environment variable that you set earlier. You can also configure optional variables:Run tests
The scripts forward all arguments topatrol build, so you can use all the same flags:Example output
Here’s what a successful test execution looks like:Viewing Results
After scheduling a test execution, view the results in the BrowserStack App Automate Dashboard. The dashboard provides:- Live test execution videos
- Device logs
- Network logs
- Screenshots at each step
- Crash reports
- Performance metrics
Available Devices
To see all available devices and OS versions, check the BrowserStack Devices List. Popular device configurations:Android Devices
Android Devices
iOS Devices
iOS Devices
Best Practices
Use Real Devices
Always test on real devices rather than simulators for the most accurate results.
Target Popular Devices
Focus your testing on the most popular devices among your user base.
Organize with Projects
Use the
BS_PROJECT environment variable to organize tests by project in the dashboard.Review Videos
Always review test execution videos to understand failures quickly.
CI/CD Integration
Integrate BrowserStack into your CI/CD pipeline:Troubleshooting
Authentication failed
Authentication failed
Verify your credentials are correct:Make sure it’s in the format
USERNAME:ACCESS_KEY with no extra spaces or quotes.Device not available
Device not available
The device you specified might not be available in your BrowserStack plan or might be busy. Check:
- The devices list for correct device names
- Your BrowserStack plan’s device access
- Try a different device or wait and retry
Upload failed
Upload failed
If app upload fails:
- Check that the APK/IPA file exists at the specified path
- Ensure the file size is under BrowserStack’s limits (currently 4GB)
- Verify your BrowserStack plan allows app uploads
Tests don't start
Tests don't start
If tests are uploaded but don’t execute:
- Verify you’re using the correct test runner (
BrowserstackPatrolJUnitRunnerfor Android) - For iOS, ensure the test plan is named “TestPlan”
- Check the BrowserStack dashboard for error messages
Next Steps
Firebase Test Lab
Compare with Google’s Firebase Test Lab
LambdaTest
Explore another cloud testing platform



