Back to Resources


Posted December 3, 2012

Sauce extension for Arquillian Drone


As part of the upcoming Sauce CloudBees webinar, we are going to demonstrate running a Clickstart, which will populate a CloudBees environment with a running Java EE application that is pre-configured to run tests using Sauce. The sample project uses Arquillian, which greatly simplifies the integration testing of Java EE applications. We've created a Sauce extension for Arquillian Drone, an add-on for Arquillian that makes running Selenium/WebDriver tests easy. To include the Sauce extension within your project, include the following dependency in your Maven pom.xml file:

<dependency>     <groupId>com.saucelabs</groupId>     <artifactId>arquillian-sauce-drone</artifactId>     <version>0.0.4</version>     <scope>test</scope> </dependency>

<repositories>     <repository>         <id>saucelabs-repository</id>         <url></url>         <releases>             <enabled>true</enabled>         </releases>         <snapshots>             <enabled>true</enabled>         </snapshots>     </repository> </repositories>

Then add the following in your arquillian.xml file:

<extension qualifier="sauce-webdriver">     <property name="userName">YOUR_SAUCE_USERNAME</property>     <property name="accessKey">YOUR_SAUCE_ACCESS_KEY</property>     <property name="browser">firefox</property>     <property name="os">Windows 2008</property>     <property name="version">4.</property> </extension>

If you are running builds using the Sauce CI plugins, then the extension will read the appropriate environment variables set by the plugin, so you can just add this to your arquillian.xml file:

<extension qualifier="sauce-webdriver"/>

The Drone logic will handle the lifecycle of your WebDriver/DefaultSelenium instance, so your test logic can be as follows:

@RunWith(Arquillian.class) public class AmazonTest {      @Drone      WebDriver driver;      @Test      public void amazonTitle() {           driver.get("");           assertEquals(" Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more", driver.getTitle());      } }

That's it! We end up with less code, and a centralised location for the configuration of the Java EE container and the WebDriver/SeleniumRC settings. Please let us know if you have any feedback on the Sauce Drone extension,and make sure you tune into our upcoming CloudBees webinar!

Author placeholder coral
The Sauce Labs Team
Dec 3, 2012
Share this post
Copy Share Link
© 2023 Sauce Labs Inc., all rights reserved. SAUCE and SAUCE LABS are registered trademarks owned by Sauce Labs Inc. in the United States, EU, and may be registered in other jurisdictions.