CDI TCK Community Documentation

- Prev
- Next

## Chapter 3. Installation

This chapter explains how to obtain the TCK and supporting software and provides recommendations for how to install/extract it on your system.

## 3.1. Obtaining the Software

You can obtain a release of the CDI TCK project from the download page on the CDI specification website. The release stream for JSR 365 is named 2.0.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 365: Contexts and Dependency Injection for Java 2.0 reference implementation (RI) project is named Weld. The release stream for JSR 365 is named 3.x. You can obtain the latest release from the download page on the Weld website.

## Note

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 SE 8 or better, which you can obtain from the Java Software website.

## 3.2. The TCK Environment

The TCK requires the following two Java runtime environments:

- Java SE 8 or better
- Java EE 7 or better (e.g., WildFly 10.x or GlassFish V4)

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 jsr365 to hold all of the jsr365-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:

## Note

This layout is assumed through all descriptions in this reference guide.

    jsr365/
       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.

## Tip

Running the TCK against the CDI RI (Weld) and WildFly

- First, you should download WildFly 10.x from the WildFly project page.
- Set the JBOSS_HOME environment variable to the location of the WildFly software.

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:

- You need to install Maven. You can find documentation on how to install Maven in the Maven: The Definitive Guide book published by Sonatype.
- Next, instruct Maven to run the TCK:

    cd jsr365/tck/weld/jboss-tck-runner
    mvn test -Dincontainer

- Use `cdi.tck.version` system property to specify particular TCK version:

    mvn test -Dincontainer -Dcdi.tck.version=1.1.2.Final

- TestNG will report, via Maven, the outcome of the run, and report any failures on the console. Details can be found in target/surefire-reports/TestSuite.txt.

## 3.3. Eclipse Plugins

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.

### 3.3.1. TestNG Plugin

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.

### 3.3.2. Maven Plugin (m2e)

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.

- PrevChapter 2. Appeals Process
- Top of page
- Front page
- NextChapter 4. Configuration