Anshita
Anshita

Reputation: 13

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.

Upvotes: 0

Views: 2061

Answers (2)

hfc
hfc

Reputation: 788

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>

Upvotes: 3

A. Kootstra
A. Kootstra

Reputation: 6981

If your test cases for each of the browser are identical, other than the browser they are run on, then I'd recommend using an orchestration tool, ex Jenkins, CI, Bamboo, etc, to kick off the different browser test runs. This way you have 1 test set, that using argument files/global variables can start a specific browser. In my mind this is a more future proof setup then copying test cases for each specific browser.

Upvotes: 3

Related Questions