SeamFramework.orgCommunity Documentation

Chapter 4. Configuration

4.1. TCK Harness Properties
4.2. The Porting Package
4.3. Configuring TestNG to execute the TCK
4.4. Configuring your build environment to execute the TCK

This chapter lays out how to configure the TCK Harness by specifying the SPI implementation classes, defining the target container connection information, and various other switches. You then learn how to setup a TCK runner project that executes the the TCK test suite, putting these settings into practice. Finally, a detailed account of how the JBoss Test Harness negotiates the execution of the tests in the container is given.

This chapter does not discuss in detail how to use the TCK in standalone mode. The JBoss Test Harness guide provides more on running in standalone mode.

The JBoss Test Harness allows the test suite to be launched in a pluggable fashion. In order to execute the TCK, the JBoss Test Harness must be configured by specifying implementations of the test launcher and container APIs.

System properties and/or the resource META-INF/, a Java properties file, are used to configure the JBoss Test Harness. You can read more about configuring the JBoss Test Harness in Section 10.1, “JBoss Test Harness Properties”.

You should set the following properties:

To run the full TCK you must additionally implement org.jboss.testharness.spi.Containers, which handles deploying the test artifact to the container. An implementations of this API is already available for JBoss AS 5.1. Therefore, you only need to implement this part of the porting package if you wish to use another container.

The CDI TCK relies on an implementation of the porting package to function. The porting package can be divided into two parts. The first part is comprised of extensions to the CDI SPIs to allow testing of a container. The second part must implement the JBoss Test Harness artifact deployment APIs for deploying artifacts to the Java EE container.

As mentioned earlier, there are times when the tests need to tap directly into the CDI implementation to manipulate behavior or verify results. The porting package includes a set of SPIs that provide the TCK this level of access without tying the tests to a given implementation.

The four SPI classes in the CDI TCK are as follows:

Please consult the JavaDoc for these interfaces for the implementation requirements.

The JBoss Test Harness is built atop TestNG, and it's TestNG that is responsible for selecting the tests to execute, the order of execution, and reporting the results. Detailed TestNG documentation can be found at

The tck-tests.xml artifact provided in the TCK distribution must be run by TestNG 5.9 (described by the TestNG documenation as "with a testng.xml file") unmodified for an implementation to pass the TCK. This file also allows tests to be excluded from a run:

<suite name="JSR-299 TCK" verbose="2">
   <test name="JSR-299 TCK">
         <class name="org.jboss.jsr299.tck.tests.context.application.ApplicationContextTest">
               <exclude name="testApplicationScopeActiveDuringServiceMethod"/>

TestNG provides extensive reporting information. Depending on the build tool or IDE you use, the reporting will take a different format. Please consult the TestNG documentation and the tool documentation for more information.

It's beyond the scope of this guide to describe in how to set up your build environment to run the TCK. The JBoss Test Harness guide describes how Weld uses Maven 2 to execute the CDI TCK. See Section 11.1, “Building a test suite runner using Maven 2”. The TestNG documentation provides extensive information on launching TestNG using the Java, Ant, Eclipse or IntellJ IDEA.