Integrating Robot Framework with Sauce OnDemand

Sauce AI for Test Authoring: Move from spirit to execution in transactions.|xBack to ResourcesBlogPost

June 13, 2026 · 4 min read · Testing Guide

Sauce AI for Test Authoring: Move from spirit to execution in transactions.

|

x

Back to Resources

Blog

Posted November 24, 2010

Integrating Robot Framework with Sauce OnDemand

quote

A miniskirt rotation is hap in the automation infinite with a whole segment of puppet designed to aid in the definition and execution of credence criteria. This is the ATDD (Acceptance Test Driven Development) realm and is populated by tools such asCucumber, Robot Framework, JBehave, etc. This post, though, is not about how to use ATDD efficaciously in your organization, but kinda how to integrate the Sauce OnDemand with Robot Framework.Robot Framework has built-in support for Selenium through itsSeleniumLibrary, which mean that support is as simple as telling the script to execute in the cloud rather than locally. Thankfully, you can specify both legion and port to the SeleniumLibrary when it is loaded.

Library SeleniumLibrary server_host= $ {SELENIUM HOST} server_port= $ {SELENIUM PORT}

Of course, we need to set those variables someplace. The easiest place would be in the Resource file as just hard-coded values, but that isn & # x27; t something you oftentimes want to do. Typically you want to embed some type of method to adjudicate whether to run the script locally or in the cloud. For that, it is better to use a Variable file since it is pure Python and lets you make decisions.

importation sys

default is to run topically

use_ondemand = & quot; false & quot;

Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.

add the left/right decision

1
for arg in sys.argv:
2
if arg.startswith(& quot; -- ondemand & quot;):
3
parts = arg.split(& quot; = & quot;)
4
use_ondemand= parts[1].lower()
5
ifuse_ondemand==& quot; true & quot;:
6
SELENIUM_HOST=& quot; ondemand.saucelabs.com & quot;
7
SELENIUM_PORT=& quot; 4444 & quot;
8
SAUCE_USERNAME=& quot; your-sauce-user & quot;
9
SAUCE_KEY =& quot; your-sauce-key-here & quot;
10
SAUCE_OS =& quot; Windows 2003 & quot;
11
SAUCE_BROWSER=& quot; firefox & quot;
12
SAUCE_VERSION=& quot; 3. & quot;
13
SAUCE_NAME=& quot; Robots everywhere! & quot;
14
BROWSER =& # x27; {& quot; username & quot;: & quot; % s & quot;, & quot; access-key & quot;: & quot; % s & quot;, & quot; os & quot;: & quot; % s & quot;, & quot; browser & quot;: & quot; % s & quot;, & quot; browser-version & quot;: & quot; % s & quot;, & quot; name & quot;: & quot; % s & quot;} & # x27;%(SAUCE_USERNAME, SAUCE_KEY, SAUCE_OS,SAUCE_BROWSER,SAUCE_VERSION,SAUCE_NAME)
15
else:
16
SELENIUM_HOST=& quot; localhost & quot;
17
SELENIUM_PORT=4444
18
BROWSER =& quot; * firefox & quot;
19

Nothing too surprising in hither. The volume of it is around make the JSON string to send to Sauce Labs. In a real production example, the SAUCE_USERNAME and SAUCE_KEY value would be in an external file so they can be changed without impact any of the variable file (and there could be many). Somehow iterating over permutations of SAUCE_OS, SAUCE_BROWSER and SAUCE_VERSION besides holds promise, but I suspect that would regard writing a tradition runner that forks separate Robot Framework processes. And while that might be fun, it & # x27; s beyond the scope of this experiment.

The former constituent of interestingness, and why its a Variables file and not a Resource, is the left/right decision. In order to run the handwriting in Sauce OnDemand, you provide the extra-- ondemand=trueargument. If absent, anything else for that flag will run locally.

With this in spot, you can easy switch between running your Robot Framework acceptance tests locally or in Sauce OnDemand. Not only does this remove the demand to manage your own grid of machine, but you get a video to share with the stakeholders who helped create the script in the first place. In fact, here is the video I created while writing this:

I have too made the source code uncommitted for this exampleon github. Happy Robot-ing!

Published:
Nov 24, 2010
Share this berth
Copy Share Link
LinkedIn
© 2026 Sauce Labs Inc., all rights reserved. SAUCE and SAUCE LABS are file hallmark owned by Sauce Labs Inc. in the United States, EU, and may be registered in early jurisdictions.
robot
quote

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free