Integrating Jenkins with Sauce OnDemand
Introduction
The Jenkins Sauce OnDemand plugin enables you to easily configure your tests invoked via Jenkins Jobs to run in the cloud using Sauce OnDemand.
In addition, the plugin can be configured to launch Sauce Connect automatically. This allows your tests in OnDemand to access web sites residing behind a firewall or even in localhost.
Installation
The Sauce OnDemand plugin can be installed via the Jenkins Plugin Manager.
The plugin is dependent on the 'Copy to Slave' plugin, which is used to copy the files required to run Sauce Connect to Jenkins Slave nodes.
Administration
After the plugin has been installed, the username and corresponding API key must be entered via the 'Manage Jenkins' - 'Configure System' page.
The plugin can be configured to retrieve the authentication details from a .sauce-ondemand file residing in the home directory. This file is used by the SeleniumClientFactory and Sauce REST API libraries. The contents of the file must be in the following format:
username=YOUR_SAUCE_USER_NAME key=YOUR_SAUCE_API_KEY
The Test Connection button will connect to Sauce OnDemand to verify that the authentication details are valid.
If a later version of the Sauce Connect library is available, then a message indicating this and a link allowing the administrator to download the latest version will appear on this page. This will update the plugin to include the latest version without affecting the specific version of the Jenkins Sauce OnDemand plugin currently being used, this doesn't require a restart of the Jenkins instance.
Job setup
The Sauce OnDemand settings for a Job can be set via the Configure link.
If the Enable Sauce Connect option is clicked, then a Sauce Connect instance is launched when the Job is run.
If the Override authentication information option is clicked, then the Job can be configured to use a different username/API key than which has been set via the 'Configure System' link.
If the Will Selenium 1 tests be run? option is clicked, then a text
field allowing the storage of the Starting URL will be shown. The value stored
in this field will be stored in a SELENIUM_STARTING_URL
environment variable.
By clicking on the Advanced button, text fields allowing the storage of the Sauce OnDemand Host and Port are displayed.
Multi-configuration Jobs
Multi-configuration Jobs can be setup to run against a series of browsers supported by Sauce OnDemand. To configure this, select the Add Axis button on a Multi-configuration Job, then click the Sauce OnDemand Cross-browser tests link.
This will present a list of the browser versions (grouped by operating system) which are supported by Sauce OnDemand. The browsers which are selected will be invoked by the Selenium tests when run against Sauce OnDemand.
