Arquillian GWT Testing extension 1.0.0.Alpha1 Released

Since we wrote this post we didn't laze around. Check our latest announcement.

The Arquillian team is proud to announce the 1.0.0.Alpha1 release of the Arquillian GWT Testing extension component!

This is the first release of the Arquillian GWT extension which aims to bring true integration testing to GWT.

Highlighted Features

Run GWT integration tests in Arquillian containers

This means that GWT integration tests can break free and execute in the actual runtime container instead of being tied to GWT’s embedded Jetty server.

Combining client-side and in-container tests

It is possible to combine GWT client-side and standard in-container tests in the same test class. This allows to test features without having to worry about the client-server bridge and should pave the way for future support of Arquillian Warp and Drone in GWT integration tests.

Getting Started

To start using the Arquillian GWT extension just add the following dependency to your project:

pom.xml
<dependency>
    <groupId>org.jboss.arquillian.extension</groupId>
    <artifactId>arquillian-gwt</artifactId>
    <version>1.0.0.Alpha1</version>
</dependency>

Writing Arquillian GWT tests

To run a test method as a GWT integration test either annotate the test class or test method with @RunAsGwtClient and specifiy the GWT module. If you annotate the test class all test methods in that class will run as GWT integration tests.

MyTestClass.java

@RunWith(Arquillian.class)
public class MyTestClass {

  @Test 
  @RunAsGwtClient(moduleName = "org.myapp.MyGwtModule")
  public void myGwtTest() {

  }
}

To help packaging your app for the test deployment Arquillian GWT provides a simple utility called GwtArchive. The next version of Arquillian GWT will automatically enhance the used WebArchive. So, you won’t need to use this utility in the future. Here’s a complete example:

GreeterRpcTest.java

@RunWith(Arquillian.class)
public class GreeterRpcTest extends ArquillianGwtTestCase {

  @Deployment
  public static WebArchive createDeployment() {
    return GwtArchive.get()
      .addClass(Greeter.class)
      .addClass(GreetingService.class)
      .addClass(GreetingServiceImpl.class);
  }

  @Test
  @RunAsGwtClient(moduleName = "org.myapp.MyGwtModule")
  public void testGreetingService() {
    GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
    greetingService.greetServer("Hello!", new AsyncCallback<String>() {
      @Override
      public void onFailure(Throwable caught) {
        Assert.fail("Request failure: " + caught.getMessage());
      }

      @Override
      public void onSuccess(String result) {
        assertEquals("Received invalid response from Server", "Welcome!", result);
        finishTest();
      }
    });
    delayTestFinish(5000);
  }
}

Note that you will only need to extend ArquillianGwtTestCase if you want to inherit GWT’s asynchronous testing methods (finishTest and delayTestFinish).

We look forward to your feedback on this release in the community forums!

What is Arquillian?

Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.

Release details

Component Arquillian GWT Testing extension
Version 1.0.0.Alpha1 view tag
Release date 2013-02-23
Released by Christian Sadilek
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-gwt jar javadoc pom

Release notes and resolved issues 1

Initial prototype release

Thanks to the following list of contributors: Christian Sadilek, Karel Piwko, Aslak Knutsen