Executing Tests

## 5 Executing Tests

The XML Binding TCK uses the JavaTest harness to execute the tests in the test suite. For detailed instructions that explain how to run and use JavaTest, see the JavaTest User’s Guide and Reference in the documentation bundle.

This chapter includes the following topics:

- Starting JavaTest

- Running a Subset of the Tests

- Running the TCK Against your selected CI

- Running the TCK Against a Vendor’s Implementation

- Test Reports

Note | The instructions in this chapter assume that you have installed and configured your test environment as described in Chapter 3, "Installation," and Chapter 4, "Setup and Configuration,", respectively.

### 5.1 Starting JavaTest

General way to run the XML Binding TCK using the JavaTest harness software is from the command line in your shell environment

#### 5.1.1 To Start JavaTest in Command-Line Mode

1. Change to `$TS_HOME/lib` directory.

2. Start JavaTest using the following command:

       $/opt/jdk-25.0.2/bin/java -jar ${TS_HOME}/lib/javatest.jar \
         -batch -testsuite ${TS_HOME} -open ${TS_HOME}/lib/javasoft-multiJVM.jti \
         -workdir -create ${TS_HOME}/work -runtests

Example 5-1 XML Binding TCK Signature Tests

To run the XML Binding TCK signature tests, enter the following commands:

    cd ${TS_HOME}/tests/api/signaturetest/jaxb
    ant runclient

Example 5-2 Single Test Directory

To run a single test directory, enter the following commands:

    cd ${TS_HOME}/tests/api/jakarta_xml/bind/JAXBContext
    ant runclient

Example 5-3 Subset of Test Directories

To run a subset of test directories, enter the following commands:

    cd ${TS_HOME}/tests/api/jakarta_xml/bind
    ant runclient

### 5.2 Running a Subset of the Tests

Use the following modes to run a subset of the tests:

- Section 5.2.1, "To Run a Subset of Tests in Command-Line Mode"

- Section 5.2.2, "To Run a Subset of Tests in Batch Mode Based on Prior Result Status"

#### 5.2.1 To Run a Subset of Tests in Command-Line Mode

1. Change to the directory containing the tests you want to run.

2. Start the test run by executing the following command:

       ant runclient

   The tests in the directory and its subdirectories are run.

#### 5.2.2 To Run a Subset of Tests in Batch Mode Based on Prior Result Status

You can run certain tests in batch mode based on the test’s prior run status by specifying the `priorStatus` system property when invoking `ant`

Invoke `ant` with the `priorStatus` property.

The accepted values for the `priorStatus` property are any combination of the following:

- `fail`

- `pass`

- `error`

- `notRun`

For example, you could run all the XML Binding tests with a status of failed and error by invoking the following commands:

    ant -DpriorStatus="fail,error" runclient

Note that multiple `priorStatus` values must be separated by commas.

### 5.3 Running the TCK Against another CI

Some test scenarios are designed to ensure that the configuration and deployment of all the prebuilt XML Binding TCK tests against one Compatible Implementation are successful operating with other compatible implementations, and that the TCK is ready for compatibility testing against the Vendor and Compatible Implementations.

1. Verify that you have followed the configuration instructions in Section 4.1, "Configuring Your Environment to Run the TCK Against the Compatible Implementation."

2. Run the tests, as described in Section 5.1, "Starting JavaTest," and, if desired, Section 5.2, "Running a Subset of the Tests."

### 5.4 Running the TCK Against a Vendor’s Implementation

This test scenario is one of the compatibility test phases that all Vendors must pass.

1. Verify that you have followed the configuration instructions in Section 4.2, "Configuring Your Environment to Repackage and Run the TCK Against the Vendor Implementation."

2. Run the tests, as described in Section 5.1, "Starting JavaTest," and, if desired, Section 5.2, "Running a Subset of the Tests."

### 5.5 Test Reports

A set of report files is created for every test run. These report files can be found in the report directory you specify. After a test run is completed, the JavaTest harness writes HTML reports for the test run. You can view these files in the JavaTest ReportBrowser when running in GUI mode, or in the web browser of your choice outside the JavaTest interface.

To see all of the HTML report files, enter the URL of the `report.html` file. This file is the root file that links to all of the other HTML reports.

The JavaTest harness also creates a `summary.txt` file in the report directory that you can open in any text editor. The `summary.txt` file contains a list of all tests that were run, their test results, and their status messages.

#### 5.5.1 Creating Test Reports

To generate test reports, enter the following command:

    ${JAVA_HOME}/bin/java -jar javatest.jar \
      -workdir ${TS_HOME}/work -writereport ${TS_HOME}/report

Choose proper directories for XML Binding TCK tests working directory and report directory.

#### 5.5.2 Viewing an Existing Test Report

Use the Web browser of your choice to view the `index.html` file in the report directory you specified from the command line.

Copyright © 2018, 2022 Oracle and/or its affiliates. All rights reserved.