CDI TCKCommunity Documentation

Chapter 8. Executing the Lang Model Test Suite

8.1. Recommendation
8.2. Example Weld Test Suite Runner

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:

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.

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);
    }
}

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

Then, execute the TCK runner with Maven as follows:

mvn test