Arquillian Extension JRebel 1.0.0.Alpha1 Released

The Arquillian team is proud to announce the 1.0.0.Alpha1 release of the Arquillian Extension JRebel component!

It’s great that we can write integration tests and that Arquillian can automatically deploy them into a container. However, writing these tests arn’t always that great. It takes precious time to wait for redeploys and often you need to fix datasets (for persistence extension), test logic or the implementation.

The JRebel extension is meant to save developers time. It leverages JRebel to hot deploy classes you have changed. The IDE takes care of recompiling the modified class and all you need to do is rerun the test.

How does JRebel extension avoid redeploys?

It creates a special metadata file for each deployment in target/jrebel-temp directory. When you run your tests it checks for this file. If the file is present then no redeploy happens.

How do I enable the JRebel extension for Arquillian?

All you need to do is add arquillian-jrebel-impl to class path (i.e. as a Maven dependency) and configure your contianer to run with the JRebel agent (I assume you have JRebel installed).

Here is an example configuration for JBoss AS7 bin/standalone.conf:

JAVA_OPTS="-javaagent:%JREBEL_HOME%/jrebel.jar $JAVA_OPTS"

Do I need rebel.xml?

Not neccesarily. Arquillian JRebel Extension can automatically generate rebel.xml based on your archives content. (Note that in cases where you add new class or resource to the archive after deployment: JRebel will most likely not pick it up).

You may of course provide your own rebel.xml and add it to testable archive with ShrinkWrap. If a rebel.xml file is found, the Arquillian JRebel Extension will skip generating it’s own.

Further reading

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 Extension JRebel
Version 1.0.0.Alpha1 view tag
Release date 2013-11-26
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-jrebel-impl jar javadoc pom

Release notes and resolved issues 5

Feature Request
  • ARQ-892 - Should be able to reference the real disk resources in rebel.xml where applicable
  • ARQ-893 - Should be able to work with EAR, WAR and JARs with rebel.xml files pr module
  • ARQ-894 - Allow developer to provide their own rebel.xml
Bug
  • ARQ-1311 - NPE when using @Deployment(testable=false)

Thanks to the following list of contributors: Bernard Labno, Aslak Knutsen

Arquillian Warp 1.0.0.Alpha5 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.Alpha5 release of the Arquillian Warp component!

This release was focused on fixing issues and setting up container interoperability tests.

I’m really proud for all the fixes which you submitted and, as I promised, we release this Alpha to allow you grab and test those changes on a monthly basis.

Container Compatibility

Thanks to the Arquillian Container adapters, it was pretty easy to setup container compatibility tests. You can see the results on Jenkins CloudBees instance

If you are missing support for your favorite container, speak up and we will add the desired configuration to the matrix!

As you can see from the results of compatibility tests, Warp and Warp JSF tests pass 100% on following containers:

  • WildFly 8.0.0.Beta1
  • JBoss AS 7.1.1.Final

Some tests have minor issues on TomEE 1.5.1 and unfortunately a number of tests fail on GlassFish 3.1. If any of these containers are of interest to you, please don’t hesitate to lend us a helping hand getting these up to 100% as well.

Warp Extensions – REST and Portlets

Warp REST extension was released in its Alpha1 version recently. Thanks Jakub Narloch and Bernard Labno for their hard work with extending Warp cross-framework coverage.

Ken Finnigan is also finalizing Warp Portlet support – his efforts helped to refine Warp core in this release significantly.

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 Warp
Version 1.0.0.Alpha5 view tag
Release date 2013-10-30
Released by Lukas Fryc
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-warp-bom pom
  • org.jboss.arquillian.extension » arquillian-warp-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-warp-spi jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-warp-impl jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-warp-jsf jar javadoc pom

Release notes and resolved issues 6

Bug Fixes + Portlet Support

Enhancement
  • ARQ-1538 - Provide the ability for Inspection methods to have multiple qualifiers
  • ARQ-1552 - Rewrite any absolute urls in Warp response content with Proxy URL
Feature Request
  • ARQ-1261 - Warp: setup container-compatibility integration builds
Bug
  • ARQ-1478 - Warp JSF: Nonexistent facelet file causes IllegalArgumentException
  • ARQ-1494 - Warp: fails when ProxyURLProvider is called more than once per test
  • ARQ-1556 - Warp Inspection methods with multiple qualifiers are executed but incorrectly verified

Thanks to the following list of contributors: Lukas Fryc, Ken Finnigan, Jan Dosoudil

Arquillian Transaction Extension 1.0.0.Final 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.Final release of the Arquillian Transaction Extension component!

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 Transaction Extension
Version 1.0.0.Final view tag
Release date 2013-10-29
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-transaction-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-transaction-spi jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-transaction-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-transaction-jta jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-transaction-bom pom

Release notes and resolved issues 4

Enhancement
  • ARQ-1529 - Enhance error reporting when user transaction cannot be found
Feature Request
Bug
  • ARQ-1473 - JUnit @Before and @After cause nested transaction

Thanks to the following list of contributors: Bartosz Majsak, Aslak Knutsen

Arquillian REST 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 REST Extension component!

This is the first release of the Arquillian REST extension.

At the moment it consist of two complementary parts:

REST client

Simplifies writing the client side of testing REST services

Warp REST extension

An extension, that with a bit of magic allows you to intercept the state of the Service prior or after to it’s execution

REST client

Sometimes you need to test your REST app as a black box. You know the interface (the contract), you have some input and know what results you expect. For this purpose Arquillian REST Client Extension is your friend. It makes your code shorter by injecting configured artifacts. The extension is based on the RestEasy client library. Both RestEasy 2.x and 3.x are supported. You only need to add the proper dependency to your classpath.

@RunWith(Arquillian.class)
public class RestClientTestCase {

  @ArquillianResource
  private URL deploymentURL;

  @Deployment(testable = false)
  public static WebArchive create()
  {
      return ShrinkWrap.create(WebArchive.class)
          .addPackage(Customer.class.getPackage())
          .addClasses(CustomerResource.class, CustomerResourceImpl.class, JaxRsActivator.class);
  }

  /**
   * Arquillian calculates resource path by using deployment URL+ArquillianResteasyResource.value
   * which is by default "rest". If your API is located under different root i.e.
   * "api_v2" then use @ArquillianResteasyResource("api_v2")
   *
   * @param customerResource configured resource ready for use, injected by Arquillian
   */
  @Test
  public void getCustomerById(@ArquillianResteasyResource CustomerResource customerResource)
  {
      // Given
      final String name = "Acme Corporation";
      final long customerId = 1L;

      // When
      final Customer result = customerResource.getCustomerById(customerId);

      // Then
      assertNotNull(result);
      assertNotNull(result.getId());
      assertEquals(name, result.getName());
  }
}

For more examples on how to use these extensions and quickly get started with development you can take a look at the integration tests that are part of project source code.

Warp REST

Arquillian Warp makes it possible to perform a gray-box testing of any servlet based in-container application. Now we are introducing an API that allows you to intercept the state of the REST services and validate the generated response including, but not limiting to the security context, response HTTP status code, HTTP headers and the response entities. The actual HTTP servlet request and responses are also being recorded, allowing you to verify them directly on the server. All of this happens in the application container, before the response is returned to the invoking client!

The WARP extension targets JAX-RS major versions and already has support for JAX-RS 1.1 and 2.0.

The JAX-RS 1.1 specification did not define any support for request interception, while this has been widely supported through implementation specific hooks, that is why in order to use the extension with JAX-RS 1.1 one of JAX-RS provider specific implementation need to be chosen. Fortunately we already support most the popular providers:

  • RESTEasy
  • Jersey
  • CXF

Now, let’s write some code:

StockServiceResourceTestCase.java
@Test
@RunAsClient
public void testStockGetWarp() {

  Warp.initiate(new Activity() {
      @Override
      public void perform() {

          // invokes the service
          stockService.getStock(1L);
      }
  }).inspect(new Inspection() {

      private static final long serialVersionUID = 1L;

      @ArquillianResource
      private RestContext restContext;

      @AfterServlet
      public void testGetStock() {

          // validates the service response
          assertEquals(HttpMethod.GET, restContext.getHttpRequest().getMethod());
          assertEquals(200, restContext.getHttpResponse().getStatusCode());
          assertEquals("application/json", restContext.getHttpResponse().getContentType());
          assertNotNull(restContext.getHttpResponse().getEntity());
      }
  });
}

For more examples on how to use these extensions and quickly get started with development you can take a look at the integration tests that are part of the projects source code.

We look forward to hearing your feedback about 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 REST Extension
Version 1.0.0.Alpha1 view tag
Release date 2013-10-23
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-rest-client-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-2x jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-3x jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-spi jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-resteasy jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-jersey jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-cxf jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-jaxrs-2.0 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-bom pom

Release notes and resolved issues 3

Feature Request
  • ARQ-912 - Setup a declarative REST testing extension
  • ARQ-1341 - Warp JAX-RS testing

Thanks to the following list of contributors: Bernard Labno, Aslak Knutsen, Jakub Narloch, Lukas Fryc

Arquillian Graphene 2.0 - Functional Testing with Elegance

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

The Arquillian team is proud to announce the 2.0.0.Final release of the Graphene component!

It’s already been a year since we announced the first alpha release of Graphene 2. Back then the Selenium project had undergone huge changes adopting the WebDriver API. We were excited to explore the new waters to make sure web applications are as easy to test as writing simple unit tests.

We quickly established some objectives for the project which evolved to what we can call Graphene 2.0 today:

  • built on top of WebDriver,
  • encourage to use/create reusable test abstractions,
  • simplify testing of AJAX pages.
  • fast development turnaround,

and last but not least, we wanted to make sure people could use the same features that were part of Graphene 1. Now, one and half year after the Graphene 1.0.0.Final release, we can finally report that we were able to rope in all of the concepts anticipated back then. During this journey we’ve basically touched all APIs and adopted all of the features while leveraging the modern WebDriver API for browser automation.

Graphene now consists of more than 700 commits from 11 code contributors – and that fact leads me to another aspect:

We would like to thank everyone who have been involved with the project so far; early adopters, issue reporters, people who improved documentation and of course people who picked up a ball and contributed to the code. You all hardened the project to the shape it is now.

Thank you, you guys rock!

How Graphene compares to WebDriver?

It’s important to say that Graphene is not just another dialect for WebDriver as we fully support the original WebDriver Java API. Instead, we add sensitive API extensions which we do believe altogether improves the experience and emphasizes ease of use – the common requirement for mass adoption.

We take the best of WebDriver such as

  • wide browser support,
  • object-oriented API,
  • testing design patterns such as Page Objects,

and we push them to the next level.

Graphene, together with its buddy Drone, are truly helpful for developers to lower the effort needed to build a reliable, robust and maintainable functional test suite. And we of course integrates seamlessly into the whole Arquillian test platform.

If you were to ask me; “whether you should just use the plain WebDriver API, or leverage Graphene?” the answer would be: you can continue using just WebDriver as you do today, and use as much or as little of Graphene as you see fit. Graphene just makes a few things a lot easier for you. The decision of which API to use can be compared to the decision you make when buying a new car – Should you buy a car with air-condition? Well, it certainly makes the ride a lot more pleasurable.

So, what’s so cool about Graphene?

Let’s go through some of the most prominent features:

Best Practices: Page Abstractions

As with WebDriver you can use Page Abstractions in the form of Page Objects. In Graphene we’ve made Page Abstractions a first class citizen, combined with dependency injection into the Arquillian test cases.

Graphene adds to this the concept of Page Fragments, which allows you to make even better abstractions. Page Fragments are so brilliant that e.g. the RichFaces project plan to offer fragments for testing their own widgets, in order to make your life super-easy.

public class UserDetailsPage {

    @FindBy(css = “.ui-timepicker”)
    private TimePicker birthday;

    public void setBirthDay(DateTime date) {
        birthday.setDate(date);
    }
}

public void TestCase {

    @Page
    private UserDetailsPage userDetails;

    @Test
    public void when_user_changes_birthday_then_admin_will_be_notified() {
        ...
        DateTime birthday = new Birthday(2012, 05, 04);
        userDetails.setBirthDay(birthday);
        ...
    }
}

Testing AJAX

Another area where Graphene excels is testing AJAX applications. In fact, Graphene doesn’t consider the WebElement as a concrete element on the target page, but rather as a proxy (or promise) for the real element that might be.

You no longer need to make sure the element you point to is not stale, since the proxy will make sure to bind to the most recent element for the given locator. This allows us to inject all Page Objects and their members using dependency injection during the start phase of the test. Members are then dereferenced as they are used.

Another useful feature is the Fluent Waiting API, which aims to better the readability of the test code.

Even more interesting is the use of Request Guards, which allow you to add synchronization points in your test logic when dealing with AJAX communication.

@FindByJQuery(“input:submit”)
private WebElement confirmButton;

@FindByJQuery(“body div.modal”)
private ModalPanel modalPanel;

// waits until a popup is opened
waitGui.until().element(popupPanel).is().visible();

// blocks until AJAX (XMLHttpRequest) communication is done
guardAjax(confirmButton).click();

Dependency Injection

Graphene is capable of providing injection of objects such as:

  • WebDriver context
  • interesting objects from WebDriver API e.g. JavascriptExecutor
  • elements using FindBy

into test objects such as:

  • Arquillian test case (class)
  • Page Objects
  • Page Fragments
  • WebElement wrappers, for example Select
@ArquillianResource
private WebDriver driver;

@ArquillianResource
private TakesScreenshot screenshotter;

You can find a complete list of resources available for injection in the Reference Documentation.

You can find a complete list of features in the Reference Documentation.

Learning Graphene

If you’re new to functional testing, I recommend you start by reading Functional Testing using Drone and Graphene which will guide you from the first build setup; through packaging parts of your application as a testable deployment and how to write your first test using Arquillian Graphene. It will give you an idea of how to structure the tests and give a few tips on how to write tests in a robust way.

Then you should focus on learning the WebDriver API.

If you already know the WebDriver API, I recommend you reading through the Reference Documentation which contain descriptions of all the Graphene features/goodies. Plus a few tips and tricks.

And finally, you can also read up on the JavaDoc.

Support and Compatibility Notes

We proactively test Graphene on Chrome, Firefox, Internet Explorer and PhantomJS, where we run our extensive test suite as part of the automated build. But generally speaking we support anything that Drone supports! We know for instance that Graphene also works on mobile devices such as Android.

From our experience, we also know that Graphene works great for testing web frameworks like JSF, GWT, AngularJS and generally it should work with any other web framework.

We hope that you’ll enjoy this new release and we look forward to your feedback on the community forum.
If you find any problems, have a new feature request, want some help spreading the word or want to show us a success story blog post, please don’t hesitate to contact us on the forum. All requests are welcome!

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 Graphene
Version 2.0.0.Final view tag
Release date 2013-10-11
Released by Lukas Fryc
Compiled against

Published artifacts org.jboss.arquillian.graphene

  • org.jboss.arquillian.graphene » graphene-parent pom
  • org.jboss.arquillian.graphene » graphene-webdriver pom
  • org.jboss.arquillian.graphene » arquillian-graphene pom
  • org.jboss.arquillian.graphene » graphene-webdriver-spi jar javadoc pom
  • org.jboss.arquillian.graphene » graphene-webdriver-api jar javadoc pom
  • org.jboss.arquillian.graphene » graphene-webdriver-impl jar javadoc pom

Release notes and resolved issues 10

Final release

Enhancement
Task
Sub-task

Thanks to the following list of contributors: Lukas Fryc