Hibernate.orgCommunity Documentation
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/jboss-test-harness.properties
, a Java properties
file, are used to configure the JBoss Test Harness. You can read more
about configuring the JBoss Test Harness in Section 9.1, “JBoss Test Harness Properties”.
You should set the following properties:
Table 4.1. Required JBoss Test Harness Configuration Properties
Property = Required/Example Value | Description |
---|---|
org.jboss.testharness.libraryDirectory=/path/to/extra/libraries
| Directory containing extra JARs you want placed in artifact library directory. |
org.jboss.testharness.standalone=false | You must run the tests in-container to pass the TCK |
org.jboss.testharness.runIntegrationTests=true
| You must run the integration tests to pass the TCK |
org.jboss.testharness.spi.Containers=com.acme.AcmeContainer
| The container implementation for deploying and executing in-container tests. See Note |
org.jboss.testharness.api.TestLauncher=org.jboss.testharness.impl.runner.servlet.ServletTestLauncher
| You should use the ServletTestLauncher
for Java EE 6 and Java EE 6 Web Profile. |
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 if you wish to use another container.
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 testng.org.
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-303 TCK" verbose="2"> <test name="JSR-303 TCK"> ... <classes> <class name="org.hibernate.jsr303.tck.tests.bootstrap.ValidationProviderTest"> <methods> <exclude name="testFirstMatchingValidationProviderResolverIsReturned"/> </methods> </class> </classes> ... </test> </suite>
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 Bean Validation uses Maven 2 to execute the Bean Validation TCK. See Section 10.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.
Copyright © 2009 - 2011 Red Hat, Inc.