JBoss Community Archive (Read Only)


Seam 2


With Arquillian Seam 2 extension you can easily test your applications created with Seam 2 framework against real containers!

Following features are supported:

  • Test enrichment for @In injection points from the Seam 2 Context.

  • Packaging support for adding the Seam 2 framework (so you don't need to specify it explictly in your @Deployment method).

You can turn off autopackaging feature in arquillian.xml. See "Additional configuration" section for details.

See it in action

Let's consider following Seam 2 component

public class FluidOuncesConverter

   public Double convertToMillilitres(Double ounces)
      return ounces * 29.5735296;


In order to test it we can write standard Arquillian-powered test:

import static org.fest.assertions.Assertions.assertThat; // Fluent assertions used in the test
// ... Arquillian and Seam 2 relevant imports

public class ComponentInjectionTestCase
   public static Archive<?> createDeployment()
      return ShrinkWrap.create(WebArchive.class, "test.war")
                       .addPackages(true, "org.fest") // Needed to run in managed / remote container
                       .addAsResource(EmptyAsset.INSTANCE, "seam.properties")

   FluidOuncesConverter fluidOuncesConverter;

   public void shouldInjectSeamComponent() throws Exception

   public void shouldConvertFluidOuncesToMillilitres() throws Exception
      // given
      Double ouncesToConver = Double.valueOf(8.0d);
      Double expectedMillilitres = Double.valueOf(236.5882368d);

      // when
      Double millilitres = fluidOuncesConverter.convertToMillilitres(ouncesToConver);

      // then

Under the hood Arquillian Seam 2 extension will enrich the test archive with all required dependencies needed for deploying Seam 2 application and deploy it to the container as web archive (WAR).

Additional configuration

You can customize Arquillian Seam 2 extension configuration in arquillian.xml by adding following element:

<extension qualifier="seam2">
  <!-- This way you can override Seam version
       which you have defined in pom.xml -->
  <property name="seamVersion">2.2.1.Final</property>

List of all available properties

Property name

Default value




Version of Seam 2 framework artifact used by autopackaging mechanism



Version of JBoss Expression Language extension artifact used by Seam 2



Turn on/off autopackaging feature.

Maven setup

The only extra dependency needed is arquillian-seam2, as described in the snippet below.


Take a look at the Getting started to see how you set up arquillian using maven.

Note: You might face problems obtaining some Seam 2 dependencies. You should add these repositories to fix the problem.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 09:40:21 UTC, last content change 2012-04-08 09:17:30 UTC.