Robot Framework is a generic open source automation framework which can be used for test automation. It is open and extensible and can be integrated with many tools to create powerful and flexible automation solutions. Robot Framework has easy syntax, utilising human-readable keywords and its capabilities can be extended by libraries implemented with Python or Java.
This BrowserStack Example repository demonstrates a Playwright test library, called Browser written in Robot Framework with parallel testing capabilities. The test scripts are written for the open source BrowserStack Demo web application (Github). This BrowserStack Demo App is an e-commerce web application which showcases multiple real-world user scenarios. The app is bundled with offers data, orders data and products data that contains everything you need to start using the app and run tests out-of-the-box.
The tests in this repo are run on BrowserStack real device/browser using various run configurations and test capabilities.
BrowserStack provides instant access to 3,000+ real mobile devices and browsers on a highly reliable cloud infrastructure that effortlessly scales as testing needs grow.
-
Clone the repository
git clone https://github.com/browserstack/robot-playwright-browserstack.git
-
It is recommended to use a virtual environment to install dependencies. To create a virtual environment:
python3 -m venv env source env/bin/activate # on Mac env\Scripts\activate # on Windows
-
Library installation requires both Python and NodeJs:
Install Python™
Install Node.js®
-
Ensure you have the dependencies installed on the machine as mentioned in the
requirements.txt file
To Install the requirements:
pip install -r requirements.txt
-
rfbowser init:
rfbrowser init
This installs the NodeJS dependencies , installation is done by default to
site-packages/Browser/wrapper/node_modules/
directory. This also install browser binaries under thenode_modules
folder, which easily can be +700Mb for each Browser library installation.
Navigate to bstackdemo, Add an item to the card and Verify the item is added to the cart.
-
Create a new BrowserStack account or use an existing one.
-
Identify your BrowserStack username and access key from the BrowserStack Automate Dashboard and export them as environment variables using the below commands.
- For unix based and Mac machines:
export BROWSERSTACK_USERNAME=<browserstack-username> && export BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
- For Windows:
set BROWSERSTACK_USERNAME=<browserstack-username> set BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
-
How to run the test?
To run the entire test suite parallely in browserstack, you will require pabot dependency.
Use the following command:
pabot --pabotlib --testlevelsplit --processes 3 ./test/sample_test.robot
You can also use the other combinations as described in pabot to run your tests parallely.
-
Output
This run profile executes the entire test suite parallely in browserstack
-
How to run the test?
To run the entire test suite parallely in browserstack, you will require pabot dependency and pabotlib dependecy, PabotLib helps in parallel execution with pabot. These allow control to when and where a keyword will be executed.
- Run Setup Only Once is used for starting the local testing connection
- Run Teardown Only Once is used for killing the local testing connection
Using Language Bindings
Follow the steps below:
pip install browserstack-local
pabot --pabotlib --testlevelsplit --processes 3 ./test/sample_local_test.robot
- View your test results on the BrowserStack Automate dashboard
- Customizing your platform capabilities on BrowserStack using our Capability documentation
- List of Browsers & mobile devices for automation testing on BrowserStack
- Using Automate REST API to access information about your tests via the command-line interface
- Understand how many parallel sessions you need by using our Parallel Test Calculator
- For testing public web applications behind IP restriction, Inbound IP Whitelisting can be enabled with the BrowserStack Enterprise offering