Blog

Thursday 26 April 2012

Arquillian meets JRebel

Writing tests with Arquillian is so cool. Our tests are run in container, we can inject various artifacts like EJBs, JMS queues, CDI beans and more into our tests.
But the turnaround for big deployments is too big. Even for smaller ones, if you for example use Seam3 or Hibernate it takes some seconds to redeploy. And those seconds add up.

But I've got good news for you!


Together with Aslak Knutsen we've developed extension for Arquillian that uses JRebel to reload changed artifacts.

Just add impl module to classpath and run test either from IDE or maven.
<dependency>
    <groupId>org.jboss.arquillian.</groupId>
    <artifactId>arquillian-jrebel-impl</artifactId>
    <version>1.0.0.Alpha1-SNAPSHOT</version>
</dependency>
Make sure you use servlet protocol! To do that add following to arquillian.xml:
<defaultProtocol type="Servlet 3.0"/>
First time you run test it will deploy the package, export the deployment to target/jrebel-temp directory and attach auto generated rebel.xml file that instructs JRebel to override deployed package with the one exported to target/jrebel-temp. Next time you run the test Arquillian will check if package exists in the temp directory and if so it will run tests without deploying the package.

If you want to force Arquillian to deploy the package again to the container you have to delete the temp directory. (For maven run "mvn clean")

Currently we've managed to get EAR and WAR deployments to work and reload on the fly. We're working on plain EJB jar support.

Many thanks to Aslak who is the brain behind this extension. Aslak we thank you so much!

Source code is available at:
https://github.com/arquillian/arquillian-extension-jrebel
Artifacts are temporarily hosted at:
http://artifactory.it-crowd.com.pl

1 comment:

  1. Awesomeness! Congrats Bernard! It's a significant milestone for Arquillian ecosystem in achieving zero turnaround in testing landscape. Kudos!

    ReplyDelete