Building and Debugging Tests

Previous Next Contents

10 Building and Debugging Tests

For final certification and branding, all tests must be run through the JavaTest test harness. However, you can execute different Ant targets during your build and debug cycle. The following sections describe how to use Ant with the following targets to rebuild, list, and run tests:

  • runclient

  • clean

  • build

  • ld, lld, lc, llc, pd, pc

Implementers can only run the version of the tests provided with the CTS for certification, except in the case of rebuildable tests.

This chapter includes the following topics:

10.1 Configuring Your Build Environment

Complete the following steps to set up your environment to build, deploy, and run the TCK tests using Ant. The following example is for the Solaris platform:

  1. Set the following environment variables in your shell environment to use the build infrastructure that comes with the TCK:

    • TS_HOME to the directory in which the Jakarta EE 9 Platform TCK software is installed.

    • TS_HOME/bin to your PATH in your command shell.

    • C Shell:

setenv PATH ${TS_HOME}/bin:${PATH}

Bourne Shell:

PATH=${TS_HOME}/bin:${PATH}
export PATH
  • JAVA_HOME to the directory in which the Java SE 8 software is installed.

  • JAVAEE_HOME to the directory in which the Jakarta Platform, Enterprise Edition Compatible Implementation (CI) is installed.

    1. Unset ANT_HOME, if it is currently set in your environment.

    2. Change to the <TS_HOME>/bin directory and verify that the ts.jte file has the following properties set:

  • webserver.home: the directory in which the CI Web Server is installed

  • webserver.host: the host on which the CI Web server is running

  • webserver.port: the port on which the CI Web server is running

  • javaee.home.ri: the directory in which the Jakarta Platform, Enterprise Edition CI is installed for reference to the packager tool used by the build infrastructure

  • ts.classpath: required classes needed for building/running the TCK

10.2 Building the Tests

To build the Jakarta EE 9 Platform TCK tests using Ant, complete the following steps:

  1. To build a single test directory, type the following:

cd <TS_HOME>/src/com/sun/ts/tests/test_dir
ant clean build

This cleans and builds the tests in the directory specified for test_dir. 2. To list the classes directory for this test that was built, type the following:

ant lc

or

ant llc
  1. To list the distribution directory of archives for this test that was built, type the following:

ant pd

or

ant pc

10.3 Running the Tests

To run the Jakarta EE 9 Platform TCK tests using Ant, use one of the following procedures.

10.3.1 To Run a Single Test Directory

To run a single test directory, type the following:

cd <TS_HOME>/src/com/sun/ts/tests/test_dir
ant runclient

This runs all tests in test_dir.

10.3.2 To Run a Single Test Within a Test Directory

To run a single test within a test directory, type the following:

cd <TS_HOME>/src/com/sun/ts/tests/test_dir
ant runclient -Dtest=test_name

This runs only the test_name in the test_dir test directory. To show all the tests that can be run from a particular test directory, change to the directory and execute the list.tests Ant task. The actual test name displays to the right of the pound sign (#), which follows the fully qualified name of the client class.

10.4 Listing the Contents of dist/classes Directories

You can use various Ant targets to list the contents of corresponding dist/classes directories from the src directory without leaving the src directory. All listings are sorted by modification time, with the most recent modification listed first. Output is redirected to more. The format may vary on Windows and Unix. Ant does not support changing directory into the dist/classes directories, but you can copy and paste the first line of the output, which is the target path.

The Ant list targets are as follows:

  • ld: Lists the contents of the current test’s dist directory

  • lld: Provides a long listing of the contents of the current test’s dist directory

  • lc: Lists the contents of the current test’s classes directory

  • llc: Provides a long listing of the contents of the current test’s classes directory

  • pd: Starts a new shell placed into the current test’s dist directory

  • pc: Starts a new shell placed into the current test’s classes directory

If you run these targets in a directory that is not under the src directory, they will list the contents of the current directory.

Note

pc, lc, and llc also support the -Dbuild.vi property for listing the rebuildable tests. The rebuildable tests are located under <TS_HOME>/classes_vi_built instead of <TS_HOME>/classes.

The following listing shows sample output for the Ant lc target.

cd $TS_HOME/src/com/sun/ts/tests/samples/ejb/ee/simpleHello
ant lc
<TS_HOME>/classes/com/sun/ts/tests/samples/ejb/ee/simpleHello
----------------------------------------------------------------
Hello.class
HelloClient.class
HelloEJB.class
HelloHome.class

ant -Dbuild.vi=true lc
<TS_HOME>/classes_vi_built/com/sun/ts/tests/samples/ejb/ee/simpleHello

----------------------------------------------------------------
Hello.class
HelloClient.class
HelloEJB.class
HelloHome.class

10.5 Debugging Service Tests

The Jakarta EE 9 Platform TCK service tests test the compatibility of the Jakarta Platform, Enterprise Edition Service APIs: Jakarta Mail, JDBC, Jakarta Messaging, Jakarta Transactions, Jakarta XML Web Services, Jakarta Web Services Metadata, Jakarta Annotations. The test suite contains sets of tests that the JavaTest harness, in conjunction with the Jakarta EE 9 Platform TCK harness extensions, runs from different Jakarta Platform, Enterprise Edition containers (Jakarta Enterprise Beans, Jakarta Server Pages, Jakarta Servlet, and application client). The test suite wraps each of these tests inside generic components, called vehicles. Each Jakarta EE 9 Platform TCK service test has been set up to run in a default set of vehicles. Each technology’s specification determines this set. When run as part of the certification process, all service API tests must pass in their default vehicle set.

Refer to the <TS_HOME>/src/vehicle.properties file to for a list the default vehicle sets for the Jakarta EE 9 Platform TCK service API tests.

To help you debug service API tests, the test suite provides a mechanism that allows for fine-grained control over which tests you can run in specific vehicles. When you override the default vehicle set for a particular set of service tests, the new set of vehicles must be a subset of the valid vehicle set for that set of tests. If the new set is not a subset of the default set, the test suite will use the default set.

Note

You can only use this mechanism for debugging purposes. For certification, you must run using the default set of vehicles.

10.5.1 Examples

Example 10-1 Restricting the JDBC Test Run

To restrict the JDBC test run to the servlet and Jakarta Server Pages vehicles only, set the following system property in the <TS_HOME>/bin/build.xml file for the Ant gui or runclient targets:

<sysproperty key="tests_jdbc_ee.service_eetest.vehicles"
  value="servlet jsp"/>

Before you run the test or tests, you should temporarily rename the file <TS_HOME>/src/testsuite.jtd.

Note that you must remove these properties before you run the Jakarta EE 9 TCK test suite for certification.

10.5.2 Obtaining Additional Debugging Information

When running the JavaTest harness in command-line mode, you can obtain additional debugging information by setting the HARNESS_DEBUG environment variable, as follows:

setenv HARNESS_DEBUG=true

Subsequent runs with the Ant runclient command generate additional debugging information.

You can also generate additional test run information by seting the <TS_HOME>/bin/ts.jte harness.log.traceflag property as follows:

harness.log.traceflag=true

Previous Next Contents
Eclipse Foundation Logo  Copyright © 2018, 2020 Oracle and/or its affiliates. All rights reserved.