JBoss Community Archive (Read Only)

Arquillian

Container config runtime selection

During execution of your Arquillian test-suite, you may have configured one or more containers with which you need to execute the test suite. This is usually configured with maven profiles, but in the case where individual container options need to be specified at runtime to the target container. This is where you will need to specify configurations in your arquillian.xml file, and also activate those configurations using Java system properties.

Example arquillian.xml with two container configurations:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns="http://jboss.org/schema/arquillian"
   xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

   <container qualifier="jbossas_managed" default="true">
      <protocol type="Servlet 3.0">
         <property name="executionType">MANAGED</property>
      </protocol>
      <configuration>
         <property name="jbossHome">${project.baseDir}/target/jboss-as-7.1.1.Final/</property>
         <property name="allowConnectingToRunningServer">true</property>
      </configuration>
   </container>
   
   <container qualifier="jetty">
      <configuration>
          <more configuration>...</more configuration>
      </configuration>
   </container>
</arquillian>

 Activating a configuration via the command line

The -Darquillian.launch system property is what controls arquillian.xml configuration selection. If you are running tests from Eclipse or directly from the command like, you should add the -D system property to your launch configuration or command.

Activating a configuration via Maven

These configurations may be activated in the maven profile using the Surefire plugin configuration in your container's maven profile to set the 'arquillian.launch' system property for test execution, as follows:

<profile>
         <id>JBOSS_AS_MANAGED_7.X</id>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <configuration>
                     <systemPropertyVariables>
                        <arquillian.launch>jbossas_managed</arquillian.launch>
                     </systemPropertyVariables>
                  </configuration>
               </plugin>
  ...
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 09:40:13 UTC, last content change 2012-05-10 20:30:19 UTC.