SeamFramework.orgCommunity Documentation
This chapter explains how to obtain the TCK and supporting software and provides recommendations for how to install/extract it on your system.
You can obtain a release of the CDI TCK project from the download page on the CDI specification website. The release stream for JSR 346 is named 1.2.x. The CDI TCK is distributed as a ZIP file, which contains the TCK artifacts (the test suite binary and source, porting package API binary and source, the test suite configuration file, the audit source and report) in /artifacts and documentation in /doc. The TCK library dependencies are not part of the distribution and can be downloaded on demand (see readme.txt file in /lib).
You can also download the current source code from GitHub repository.
The TCK project is also available in the Maven Central repository. The POM file defines all dependencies required to build the TCK.
<dependency>
<groupId>org.jboss.cdi.tck</groupId>
<artifactId>cdi-tck-impl</artifactId>
<version>${cdi-tck.version}</version>
</dependency>
Executing the TCK requires a Java EE 7 or better runtime environment (i.e., application server), to which the test artifacts are deployed and the individual tests are invoked. The TCK does not depend on any particular Java EE implementation.
The JSR 346: Contexts and Dependency Injection for Java EE 1.1 reference implementation (RI) project is named Weld. The release stream for JSR 346 is named 2.x. You can obtain the latest release from the download page on the Weld website.
Weld is not required for running the CDI TCK, but it can be used as a reference for familiarizing yourself with the TCK before testing your own CDI implementation.
Naturally, to execute Java programs, you must have a Java SE runtime environment. The TCK requires Java 7 or better, which you can obtain from the Java Software website.
The TCK requires the following two Java runtime environments:
You should refer to vendor instructions for how to install the runtime environment.
The rest of the TCK software can simply be extracted. It’s recommended that you create a folder named jsr346 to hold all of the jsr346-related projects. Then, extract the TCK distribution into a subfolder named tck. If you have downloaded the Weld distribution, extract it into a sibling folder named weld. The resulting folder structure is shown here:
This layout is assumed through all descriptions in this reference guide.
jsr346/ weld/ tck/
Each test class is treated as an individual artifact. All test methods (i.e., methods annotated with @Test
) in the test class are run in the application, meaning bean discovery occurs exactly once per artifact and the same BeanManager is used by each test method in the class.
Running the TCK against the CDI RI (Weld) and WildFly
The CDI TCK distribution includes a TCK runner that executes the TCK using Weld as the CDI implementation and WildFly as the Java EE runtime. To run the TCK:
cd jsr346/tck/weld/jboss-tck-runner mvn test -Dincontainer
cdi.tck.version
system property to specify particular TCK version:
mvn test -Dincontainer -Dcdi.tck.version=1.1.2.Final
Eclipse, or any other IDE, is not required to execute or pass the TCK. However an implementor may wish to execute tests in an IDE to aid debugging the tests. This section introduces two essential Eclipse plugins, TestNG and Maven, and points you to resources explaining how to install them.
The TCK test suite is built on the TestNG. Therefore, having the TestNG plugin installed in Eclipse is essential. Instructions for using the TestNG update site to add the TestNG plugin to Eclipse are provided on the TestNG download page. You can find a tutorial that explains how to use the TestNG plugin on the TestNG Eclipse page.
Another useful plugin is m2e. The TCK project uses Maven. Therefore, to work with TCK in Eclipse, you may wish to have native support for Maven projects, which the m2e plugin provides. Instructions for using the m2e update site to add the m2e plugin to Eclipse are provided on the m2e home page.
You can alternatively use the Eclipse plugin for Maven to generate native Eclipse projects from Maven projects.
If you have Maven installed, you have everything you need. Just execute the following command from any Maven project to produce the Eclipse project files.
mvn eclipse:eclipse
Again, the Eclipse plugins are not required to execute the TCK, but can be very helpful when validating an implementation against the TCK test suite and especially when using the modules from the project.