CDI TCK Community Documentation

- Prev
- Next

## Chapter 8. Executing the Lang Model Test Suite

The Language Model TCK does not depend on any test framework or test runner. Assertions are made using Java `assert`. The tests are executed in an implementation-defined manner.

To run the Language Model TCK, implementations must call the `org.jboss.cdi.lang.model.tck.LangModelVerifier#verify()` static method and pass it a `ClassInfo` object for the `LangModelVerifier` class. The way how this method is called and how the `ClassInfo` object is obtained are not specified, so that implementations are free to use whatever works best for them. Two conditions must be satisfied:

- assertions are enabled;
- the language model under test is configured to only return runtime-retained annotations.

If the `verify` method returns successfully, the TCK passed. If it throws an exception, the TCK failed.

To aid with debugging, the `verify` method prints a message to the JVM standard output in case of a success.

## 8.1. Recommendation

For CDI implementations, it is easiest to run the Language Model TCK using a build compatible extension. For example:

    public class LangModelVerifierExtension implements BuildCompatibleExtension {

        @Enhancement(types = LangModelVerifier.class, withAnnotations = Annotation.class)

        public void run(ClassInfo clazz) {

            LangModelVerifier.verify(clazz);

        }

    }

## 8.2. Example Weld Test Suite Runner

To execute the TCK test suite against Weld, first switch to the jboss-tck-runner directory in the extracted TCK distribution:

    cd jakartacdi/tck/weld/lang-model-tck

## Note

These instructions assume you have extracted the Jakarta CDI TCK software according to the recommendation given in Section 3.2, “The TCK Environment”.

Then, execute the TCK runner with Maven as follows:

    mvn test

- PrevChapter 7. Executing the Test Suite
- Top of page
- Front page
- NextChapter 9. Running Tests in Eclipse