Search code examples
robotframeworksaucelabs

How to pass variable file to a test when running robot framework tests on sauce labs?


I am trying to run some robot framework tests on sauce labs. I am not able to pass a variable file to my pybot command. When I run my tests locally I use this command :

pybot  -vbrowser:firefox -vbaseur  --variablefile ../VariableFiles/superdesk.py mytest.robot 

On sauce labs I need to pass some other variables: sauce username, key...

pybot -v browser:firefox -v baseurl:http://myurl.fr -v sauce_apikey:mykey -v sauce_platform:linux -v sauce_username:myusername mytest.robot

How could I pass a variable to the second command as as soon as I pass --variable filemy tests run locally and not on sauce labs.

I have tried this command

pybot -v browser:firefox -v baseurl:http://myurl.fr -v sauce_apikey:mykey -v sauce_platform:linux -v sauce_username:myusername --variablefile myvarfile.py mytest.robot 

When running the command above the variable file is not taken into account. My tests run with default variables


Solution

  • The literal answer to your question is "you pass a variable file to a test the same way no matter whether you are using saucelabs or not".

    Unless robot is throwing an error, your variable file is being passed to robot when you include --variablefile myvarfile.py. You can write a simple test to verify that, by having the test log the values from the variable file.

    If you are seeing different behaviours, the behaviours must be in your test cases, or in your own variable file. There is no feature in robot that behaves differently when running on saucelabs or not.