-1

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

Bryan Oakley
  • 310,202
  • 36
  • 445
  • 584
Ziwdigforbugs
  • 1,121
  • 8
  • 22
  • 39
  • I don't understand the question. You can continue to use both -v and --variablefile at the same time. Are you saying you are using both, and that -v is overriding the variables in your variable files, and you don't want it to? – Bryan Oakley Sep 24 '15 at 12:05
  • My question is how I can pass a variable file to Pybot when using the second command meaning running my tests on sauce labs. Thanks – Ziwdigforbugs Sep 24 '15 at 12:11
  • Have you actually tried using --variablefile when running on saucelabs? I don't understand the problem. – Bryan Oakley Sep 24 '15 at 12:19
  • sorry for not being clear, yes I did use --variablefile when running on sauce labs but this is not taken into account. when I use --variablefile locally the browser open the exact URL tha I set in my variable file. However in sauce labs it opens the default URL as if i did not add --variable file to pybot – Ziwdigforbugs Sep 24 '15 at 12:26
  • The problem is likely in your test, not in the variable file. If robot didn't process the variable file it would have thrown an error. I bet if you put a log statement in one of your tests you would see that all of the variables in your variablefile are being defined. – Bryan Oakley Sep 24 '15 at 12:41

1 Answers1

2

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.

Bryan Oakley
  • 310,202
  • 36
  • 445
  • 584
  • Well I agree with you that in theory this should be the correct behaviour, now the reason why I am not sure this is related to my test implementation is the fact that when I run my test locally with the variable file the test runs on the correct URL let's say URL B. However when I run my tests in sauce labs with the variable file it runs on URL A which is a URL by default I am setting in a resource file. – Ziwdigforbugs Sep 24 '15 at 14:41
  • @Z: write a very simple test that does nothing but log variables from your variable file, and you can see real quick whether the file is being loaded or not. – Bryan Oakley Sep 24 '15 at 14:47
  • I have finally find out that it was a problem in my test, I was using open browser keyword without giving remot_url and desired capabilities. Thanks Bryan for confirming that my doubts were wrong. – Ziwdigforbugs Sep 24 '15 at 17:00