/parallel-testing-with-robot-framework

The repo contains demo on performing parallel testing with Selenium Robot (on Local Grid as well as on LambdaTest Grid)

Primary LanguageRobotFramework

Perform the following steps for running the Robot tests in parallel on the Selenium Grid:

Installation of Python packages

Packages that need to be installed are present in pyproject.toml Execution is performed on the LambdaTest Selenium Grid. We are using Selenium 4.9.0 for the execution.

Install the Python packages by running the poetry install command on the terminal

poetry install

It installs the libraries that are required for testing. Shown below is the execution snapshot:

Screenshot 2022-09-16 at 2 10 49 PM

Screenshot 2022-09-16 at 2 12 17 PM

Screenshot 2022-09-16 at 2 12 04 PM

Screenshot 2022-09-16 at 2 12 29 PM

Screenshot 2022-09-16 at 2 12 46 PM

Install the project dependencies by running poetry install or poetry install --no-root on the terminal

Robot_Poetry_Install

The global dependencies (i.e. Robot Framework 6.0 and Selenium 4.9.0) are installed by running pip install -r requirements.txt or pip3 install -r requirements.txton the terminal

Robot_Requirements_Install

Configure Environment Variables

Before the tests are run, please set the environment variables LT_USERNAME & LT_ACCESS_KEY from the terminal. The account details are available on your LambdaTest Profile page.

For macOS:

export LT_USERNAME=LT_USERNAME
export LT_ACCESS_KEY=LT_ACCESS_KEY

For Linux:

export LT_USERNAME=LT_USERNAME
export LT_ACCESS_KEY=LT_ACCESS_KEY

For Windows:

set LT_USERNAME=LT_USERNAME
set LT_ACCESS_KEY=LT_ACCESS_KEY

Splitting test execution at the suite level

As stated in the official documentation of Robot framework, Pabot splits execution on suite level (by default). That means that each process will run a single suite. Test Cases from the suite will be executed sequentially.

Run the following command pabot --verbose --processes 4 Tests/CloudGrid/ on the terminal to run tests in parallel at the suite-level. This command will run the tests in the respective .robot files in parallel, whereas individual tests in each robot file will run in a sequential manner.

Shown below is the terminal screenshot of successful execution:

Robot_Suite_Level_Execution_Terminal

As seen on the LambdaTest Automation Dashboard, three tests - 2 from Tests/test_todo_app.robot and 1 from Tests/test_sel_playground.robot are run in parallel

Robot_Suite_Level_Execution_Progress

Here is the successful execution status as seen in the LambdaTest Automation Dashboard

Robot_Suite_Level_Execution_Completion

Splitting test execution on the test level

Run the following command pabot --verbose --processes 4 --testlevelsplit Tests/CloudGrid/ on the terminal to run tests in parallel at the test-level. This command will run the tests in the respective .robot files in parallel.

Shown below is the terminal screenshot of successful execution:

Robot_Test_Level_Execution

As seen on the LambdaTest Automation Dashboard, three tests - 2 from Tests/test_todo_app.robot and 1 from Tests/test_sel_playground.robot are run in parallel

Robot_Test_Level_Execution_Progress

Here is the successful execution status as seen in the LambdaTest Automation Dashboard

Robot_Test_Level_Execution_Completion

Need Assistance?

Feel free to fork the repo and contribute to make it better! Email to himanshu[dot]sheth[at]gmail[dot]com for any queries or ping me on the following social media sites:

Twitter: @hjsblogger
LinkedIn: @hjsblogger