1
*** 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.

1
  • you cannot run parallel tests in RIDE.
    – Embedded
    Commented Aug 24, 2020 at 11:39

2 Answers 2

1

You could use Pabot: A parallel executor for Robot Framework tests.

From their GitHub page. You can find more advanced use-cases and documentations here.

Run same tests with two different configurations.

pabot --argumentfile1 first.args --argumentfile2 second.args [path to tests]

I am not very familiar with RIDE, but I think you can configure Pabot as an executor.

0

I use Browserstack (not with RF), but let's see how you can do it. I believe similar approach might be possible with Sauce Labs.

First I need some variables:

*** Variables ***
${base_url}                    https://www.google.com/
${os}                          windows
${os_version}                  10
${browser}                     chrome
${browser_version}             84
${browserstack_username}       username
${browserstack_accesskey}      secret

You especially choose what OS and browser you want to run your tests in Browserstack: ${os}, ${os_version}, ${browser}, and ${browser_version}.

Currently, I am passing the variable browser from command line.

You can keep doing it with the above-mentioned four variables.

Then you need to open a browser in Browserstack:

*** Keywords ***
Open Browser In Browserstack
    ${remoteUrl}                Set Variable        http://${browserstack_username}:${browserstack_accesskey}@hub.browserstack.com:80/wd/hub
    &{desired_capabilities}      Create Dictionary   os=${os}     os_version=${os_version}     browser=${browser}   browser_version=${browser_version}
    Open Browser      ${baseUrl}    remote_url=${remote_url}     desired_capabilities=${desired_capabilities}

And so you can then put it all together:

*** Settings ***
Library    SeleniumLibrary      

*** Variables ***
${base_url}                    https://www.google.com/
${os}                          windows
${os_version}                  10
${browser}                     chrome
${browser_version}             84
${browserstack_username}       username
${browserstack_accesskey}      secret

*** Keywords ***
Open Browser In Browserstack
    ${remoteUrl}                Set Variable        http://${browserstack_username}:${browserstack_accesskey}@hub.browserstack.com:80/wd/hub
    &{desired_capabilities}      Create Dictionary   os=${os}     os_version=${os_version}     browser=${browser}   browser_version=${browser_version}
    Open Browser      ${baseUrl}    remote_url=${remote_url}     desired_capabilities=${desired_capabilities}

*** Test Cases *** 
Browserstack
    Open Browser In Browserstack    

When I navigate to Browserstack, I can see my test:

enter image description here

I think this what I've shown is really all you need, but:

to run the above test case at the same time

well, I feel you can use what's already available, e.g. pabot. I have never tried this, so you can give it a try and let me know in the comment section if it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.