Last summer, we introduced the Bamboo Sauce plugin at Atlas Camp, making it push-button simple for Bamboo users to run their Selenium tests on the Sauce OnDemand cloud. This post outlines enhancements to Bamboo Sauce to brings all the advances in Sauce OnDemand to the growing Bamboo community.
We've made a few enhancements to the Atlassian Bamboo Sauce OnDemand plugin over the last couple of weeks. The plugin allows you to set the Selenium configuration (eg. browser/operating system/etc) at the Bamboo build configuration level, making it a painless exercise to run your integration tests against a variety of different browsers using Sauce OnDemand without having to make coding changes.
Selenium 2 Support The Bamboo Sauce OnDemand plugin now supports Selenium v1 or Selenium v2. If Selenium v2 support is selected, the plugin will set some additional environment variables that reference the selected Selenium configuration which can be used as part of your tests, eg.
String seleniumUrl = System.getenv("SELENIUM_URL"); String browser = System.getenv("SELENIUM_BROWSER"); String version = System.getenv("SELENIUM_VERSION"); String platform = System.getenv("SELENIUM_PLATFORM"); DesiredCapabilities capabilities = new DesiredCapabilities(browser, version, platform); capabilities.setCapability("name", "Your Selenium 2 Test"); WebDriver driver = new RemoteWebDriver(new URL(seleniumUrl),capabilities);
Sauce Job Results in Bamboo UI The Bamboo Sauce OnDemand plugin now supports embedding the Sauce Job information with the Bamboo user interface. In order for the Job results to appear in the Bamboo UI, Sauce OnDemand needs to be told what the Bamboo build number is. The easiest way to do this is to use the selenium-client-factory to set the build number by running the following:
Selenium selenium = SeleniumFactory.create(); //cast the Selenium instance to SauceOnDemandSelenium SauceOnDemandSelenium sauce = (SauceOnDemandSelenium) selenium; //set the build number sauce.setBuildNumber(System.getenv("BAMBOO_BUILDNUMBER"));
If you're not using the selenium-client-factory, you can configure your tests to tell Sauce OnDemand the Bamboo build number by invoking the Sauce REST API.
Selenium-Client-Factory Usage Notes We have also updated the selenium-client-factory library which makes running your Selenium tests run against either a local Selenium server or Sauce OnDemand a cinch. Selenium example:
Selenium selenium = SeleniumFactory.create();
WebDriver example:
WebDriver selenium = SeleniumFactory.createWebDriver();
Instantiating your Selenium tests using the above mechanism will automatically use the configuration items specified on the Bamboo plan. That is, you won't need to explicitly reference the environment variables that Bamboo sets - they will be used by the factory logic.