Arquillian is a container-oriented testing platform from the JBoss Community. It helps to separate test logic from deployment and container lifecycle concerns in order to achieve easy and fast integration tests. It works with JUnit and TestNG, Maven, Ant (+Ivy) and Gradle.
Many containers are available in embedded, managed and remote varieties, e.g. Weld SE and EE or Glassfish as CDI/EJB containers, enabling fast deployment on the respective reference implementation. Thus, injection of the SUT into the test context/fixture can be achieved by the usual suspects such as
Functional Web Service and Web UI tests can be executed on Local, Servlet 2.5 and Servlet 3.0 protocols. Selenium 1 and 2, WebDriver and Graphene can be integrated using the Drone extension, which manages the lifecycle of the objects required for web tests. The JSFUnit annotations
@JSFServerSession can also be used as described here.
Arquillian uses a
@Deployment mechanism based on ShrinkWrap, an archiver DSL for assembling JARs, WARs and EARs using class and package patterns as well as Maven dependencies, which makes is quite easy to bootstrap arbitrary component aggregates on various levels of integration. The Maven features depend on Aether, thus Wagon and Plexus are dependencies of the test scope.
The idea of small integrated tests leverages the testing strategy to satisfy structural conditions (as proposed by Elaine J. Weyuker) to avoid what we experience if systems fail when we start to integrate (where error and testing cost rise). Early integration can prevent us from writing mockup code like for JPA or JMS tests that actually can cheaply be executed in-memory within the test VM on standard infrastructure (micro-deployments). TDD can directly be performed on the integration level and platform of choice. Different system configurations can quickly be added on demand (multi-container-deployments).
Arquillian’s concept of test logic isolation as an impetus to write, refactor and review expressive and maintainable test code, as well as the reduced test execution time and container flexibility, will be very useful in productive (ease of CI!) and educational contexts.
- Arquillian Reference Guide
- Video by Dan Allen and Aslak Knutsen (at JUDCon 2011)
- Article by Dan Allen (at JAXenter)
- Arquillian & JSFUnit
- Arquillian in the JBoss Nexus
- Arquillian Issue Tracker
- Arquillian’s name’s origin
- Apache Cactus (can be considered a historical predecessor of Arquillian)