JBoss.orgCommunity Documentation

Chapter 4. Target containers

4.1. Container varieties
4.2. Supported containers

Arquillian's forte is not only in its ease of use, but also in its flexibility. Good integration testing is not just about testing in any container, but rather testing in the container you are targeting. It's all too easy to kid ourselves by validating components in a specialized testing container, only to realize that the small variations causes the components fail when it comes time to deploy to the application for real. To make tests count, you want to execute them in the real container.

Arquillian supports a variety of target containers out of the box, which will be covered in this chapter. If the container you are using isn't supported, Arquillian makes it very easy to plug in your own implementation.

There are two styles of containers that you can target in Arquillian:

Containers can be further classified by their capabilities. There are three common catagories:

Arquillian provides SPIs that handle each of the tasks involved in controlling the runtime environment, executing the tests and aggregating the results. So in theory, you can support just about any environment that can be controlled with the set of hooks you are given.

The implementations provided so far are shown in the table below. Also listed is the artifactId of the JAR that provides the implementation. To execute your tests against a container, you must include the artifactId that corresponds to that container on the classpath. Use the following Maven profile definition as a template to add support for a container to your Maven build, replacing %artifactId% with the artifactId from the table. You then activate the profile when executing the tests just as you did in the Chapter 3, Getting started chapter.


<profile>
   <id>%artifactId%</id>
   <dependencies>
      <dependency>
         <groupId>org.jboss.arquillian.container</groupId>
         <artifactId>%artifactId%</artifactId>
         <version>${arquillian.version}</version>
      </dependency>
   </dependencies>
</profile>

Support for other containers is planned, including GlassFish V3(remote), Tomcat and Jetty. We don't have plans to provide implementations for Spring or Guice at this time, but we welcome a contribution from the community, because it's certainly possible.