We are trying to run the automation tests written in robot framework in parallel using locust.
As of now, we have been able to run the robot-framework test file through locust by using the robot-framework's robot package.
Code
1. Locust Script
import robot
from locust import HttpUser, task, between
class QuickstartUser(HttpUser):
wait_time = between(0.1, 0.2)
@task
def robot_parallel_test(self):
robot.run('robot_test1.robot')
2. Robot Framework test script (robot_test1.robot)
*** Settings ***
Library Selenium2Library
*** Variables ***
${URL} http://www.google.com
${BROWSER} Chrome
${search_form} css=form[name=f]
${search_query} css=input[name=q]
${search_term} RobotFramework
*** Test Cases ***
Google Search
Open Browser ${URL} ${BROWSER}
Wait Until Element Is Visible ${search_form}
Wait Until Element Is Visible ${search_query}
Input Text ${search_query} ${EMPTY}
Input Text ${search_query} ${search_term}
Submit Form
When we run the locust script, is starts running the robot framework tests by opening instances of Chrome and executing the automation. The problem here is that while one automation script is running, locust opens another instance of chrome which affects the previously running robot test cases and all tests fail.
We have tried running the tests in headless mode but they still fail if another test runs while the current test is running.
We are looking for a way to run our robot automation tests in parallel through locust so that they keep on running in parallel and do not disrupt each other flows, so that we can load test our application with concurrent users.
There is a library pabot which helps run robot scripts in parallel but we are trying to achieve this via locust.