robotframeworkparallel-testing

How can we run test cases on different browser at once in robotframework using Ride


*** Settings ***
Library           SeleniumLibrary

*** Variables ***
${url}            https://www.youtube.com/
${browser}        chrome

*** Test Cases ***
Search
    [Template]
    Open Browser    ${url}    ${browser}
    Maximize Browser Window

NOTE : If we want to run the above test case at the same time on different browsers. How can we handle it in robot framework (Is it possible to integrate with sauce labs / browser stack). Currently, I am passing the variable browser from command line. eg : robot --variable BROWSER:Chrome Youtube.robot

But I want to run it on different browsers at once.


Solution

  • You will need to use Pabot for parallel testing. The easiest way to run them in parallel will be creating 3 different test cases and call pabot using --testlevelsplit. However, if you don't want to replicate the test cases then you can use the --argumentfile option.

    You will need to create as many files as you wish with the variable that you can to test. For example:

    arg1.txt:

    --variable browser:chrome
    

    arg2.txt

    --variable browser:ie
    

    And then run:

    pabot  --pabotlib --argumentfile1 arg1.txt --argumentfile2 arg2.txt -t "Search" <PATH_TO_TEST_DIR>