BrowserStack Integration with Robot Framework Appium (Python)
Setup
- Clone the repo
- Install dependencies
pip install robotframework==3.2.2
pip install --upgrade robotframework-appiumlibrary
pip install robotframework-pabot
pip install browserstack-local
- Upload your Android or iOS App
Upload your Android app (.apk or .aab file) or iOS app (.ipa file) to BrowserStack servers using our REST API. Here is an example cURL request :curl -u "BROWSERSTACK_USERNAME:BROWSERSTACK_ACCESS_KEY" \ -X POST "https://api-cloud.browserstack.com/app-automate/upload" \ -F "file=@/path/to/apk/file"
Set BrowserStack Credentials
-
You can export the environment variables for the Username and Access Key of your BrowserStack account.
export BROWSERSTACK_USERNAME=<browserstack-username> && export BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>&& export BROWSERSTACK_APP_ID=<app-hashed-id>
Running tests
Android
- To run single test, run
robot tests/android/SingleTestAndroid.robot
- To run local tests, run
robot tests/android/LocalTestAndroid.robot
- To run parallel tests we will be using the Pabot library,
- Test Suite level
- Run -
pabot --processes <count_of_parallels> tests/android/parallel/*.robot
- Alternate method:
pabot --processes <count_of_parallels> <name_of_suites_to_run>
Eg:pabot --processes 2 Suite1.robot Suite2.robot
- Run -
- Test case level
- Run -
pabot --testlevelsplit <file_name>
Eg:pabot --testlevelsplit Suite1.robot
- Run -
- Run Test cases and Test suites together in parallel
- Run -
pabot --testlevelsplit --processes <count_of_parallels> *.robot
Note: If the process count exceeds the parallel thread limit, it will automatically get queued. No changes required in the scripts.
- Run -
- Test Suite level
iOS
- To run single test, run
robot tests/iOS/SingleTestiOS.robot
- To run local tests, run
robot tests/iOS/LocalTestiOS.robot
- To run parallel tests we will be using the Pabot library,
- Test Suite level
- Run -
pabot --processes <count_of_parallels> tests/iOS/parallel/*.robot
- Alternate method:
pabot --processes <count_of_parallels> <name_of_suites_to_run>
Eg:pabot --processes 2 Suite1.robot Suite2.robot
- Run -
- Test case level
- Run -
pabot --testlevelsplit <file_name>
Eg:pabot --testlevelsplit Suite1.robot
- Run -
- Run Test cases and Test suites together in parallel
- Run -
pabot --testlevelsplit --processes <count_of_parallels> *.robot
Note: If the process count exceeds the parallel thread limit, it will automatically get queued. No changes required in the scripts.
- Run -
- Test Suite level
Understand how many parallel sessions you need by using our Parallel Test Calculator
Notes
- This repository only works for Selenium 3 as of now. Desired Capabilities do not get honoured for Selenium 4. The open issue on SeleniumLibrary can be found here.
- You can view your test results on the BrowserStack Automate dashboard
- To test on a different set of browsers, check out our platform configurator