browserstack / robot-browserstack

Code samples for robot tests on browserstack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BrowserStack Integration with Robot Framework Selenium (Python)

BrowserStack Logo

Setup

  • Clone the repo
  • Install dependencies pip install -r requirements.txt

Set BrowserStack Credentials

  • Export the BrowserStack username and access key as environment variables

For Linux/MacOS

export BROWSERSTACK_USERNAME=<browserstack-username>
export BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>

For Windows

setx BROWSERSTACK_USERNAME=<browserstack-username>
setx BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>

Running tests

  • To run local test, run robot tests/LocalTest.robot
  • To run parallel tests we will be using the Pabot library:
    1. To run test suites in parallel (Testcases within respective test suites will be sequential)
      • Run - pabot --processes <count_of_parallels> tests/parallel/*.robot
      • Alternate method: pabot --processes <count_of_parallels> <name_of_suites_to_run>
        Eg: pabot --processes 2 tests/parallel/Suite01.robot tests/parallel/Suite02.robot
    2. To run all test cases within a test suite in parallel
      • Run - pabot --testlevelsplit <test_suite_file_name>
        Eg: pabot --testlevelsplit tests/parallel/Suite01.robot
    3. Run all testcases across all Test Suites in parallel
      • Run - pabot --testlevelsplit --processes <count_of_parallels> tests/parallel/*.robot
        Note: If the process count exceeds the parallel threads available on BrowserStack, the sessions will automatically get queued.

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

Additional Resources

About

Code samples for robot tests on browserstack


Languages

Language:RobotFramework 74.1%Language:Python 25.9%