Sauce extension for Arquillian Drone

Posted by The Sauce Labs Team in Sauce Product InfoSoftware Development & Testing

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>https://repository-saucelabs.forge.cloudbees.com/release</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("http://www.amazon.com/");
          assertEquals("Amazon.com: 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!

Discuss: Sauce extension for Arquillian Drone
0 Comments

Free Trial

Get access to a free 14-day trial version, or contact Sales for more information.