<!-- Fragment document type declaration subset:
Arbortext, Inc., 1988-2006, v.4002
<!DOCTYPE SOLBOOK PUBLIC "-//Sun Microsystems//DTD SolBook 3.1//EN" [
<!ENTITY % TCKentities SYSTEM "TCKentities.ent">
%TCKentities;
]>
-->
<?Pub UDT _bookmark _target>
<?Pub CX solbook(>
<chapter id="GBFWO"><title>Executing Tests</title>
<highlights>
<para>The &TCKShortName; 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 <citetitle>JavaTest User's Guide and Reference</citetitle> in
the documentation bundle.</para>
<para>This chapter includes the following topics:</para>
<itemizedlist>
<listitem><para><olink targetptr="GBFUZ">Starting JavaTest</olink></para>
</listitem>
<listitem><para><olink targetptr="GBFWM">Running a Subset of the Tests</olink></para>
</listitem>
<listitem><para><olink targetptr="GBWKD">Building/Deploying/Running &TCKShortName; Tests
Using <filename>tsant</filename></olink></para></listitem>
<listitem><para><olink targetptr="GBFVK">Test Reports</olink></para></listitem>
</itemizedlist>
<note><para>The instructions in this chapter assume that you have installed
and configured your test environment as described in <olink type="custom-text"
targetptr="GBFTP">Chapter 3</olink> and <olink type="custom-text"
targetptr="GBFVV">Chapter 4</olink>, respectively.</para></note>
</highlights>
<sect1 id="GBFUZ"><title>Starting JavaTest</title>
<para>There are two general ways to run the &TCKShortName; using the JavaTest
harness software:</para>
<itemizedlist>
<listitem><para>Through the JavaTest GUI</para></listitem>
<listitem><para>From the command line in your shell environment</para>
</listitem>
</itemizedlist>
<note><para>The <command>tsant</command> command referenced in the following
two procedures and elsewhere in this guide is a wrapper around the Ant build
tool, which is included in the &TCKShortName; bundle. The <filename>build.xml</filename> file
in <filename>&lt;TS_HOME>/bin</filename> contains the various Ant targets
for the &TCKShortName; test suite</para></note>
<task id="GBFWH"><title>To Start JavaTest in GUI Mode</title>
<procedure>
<step><para>Change to the <filename>&lt;TS_HOME>/bin</filename> directory
and execute the <command>tsant gui</command> target:</para>
<literallayout><command>cd &lt;TS_HOME>/bin</command>
<command>./tsant gui</command></literallayout></step>
</procedure>
</task>
<task id="GBFVW"><title>To Start JavaTest in Command-Line Mode</title>
<procedure>
<step><para>Change to any subdirectory under <filename>&lt;TS_HOME>/src/com/sun/ts/tests
</filename>.</para></step>
<step><para>Execute the <command>tsant runclient</command> target to start
the JavaTest run:</para>
<literallayout><command>&lt;TS_HOME>/bin/tsant runclient</command></literallayout>
<para>For example, to run the &TCKShortName; signature tests, enter the following
commands:</para>
<literallayout><command>cd &lt;TS_HOME>/src/com/sun/ts/tests/signaturetest/saaj</command>
<command>&lt;TS_HOME>/bin/tsant runclient</command></literallayout></step>
</procedure>
</task>
</sect1>
<sect1 id="GBFWM"><title>Running a Subset of the Tests</title>
<task id="GBFVT"><title>To Run a Subset of Tests in GUI Mode</title>
<procedure>
<step><para>Click <emphasis>Configure->Change Configuration->Tests to Run</emphasis> from
the JavaTest main menu.</para><para>The tabbed Configuration Editor dialog
is displayed.</para></step>
<step><para>Click <emphasis>Specify</emphasis> from the option list on the
left.</para></step>
<step><para>Select the tests you want to run from the displayed test tree,
and then click <emphasis>Done</emphasis>.</para><para>You can select entire
branches of the test tree, or use <keycap>Ctrl+Click</keycap> or <keycap>Shift+Click
</keycap> to select multiple tests or ranges of tests, respectively.</para>
</step>
<step><para>Click <emphasis>Save File</emphasis>.</para></step>
<step><para>Click <emphasis>Run Tests->Start</emphasis> to run the tests you
selected.</para><para>Alternatively, you can right-click the test you want
from the test tree in the left pane of the JavaTest main window, and choose <emphasis>
Execute These Tests</emphasis> from the popup menu.</para></step>
<step><para>Click <emphasis>Report->Create Report</emphasis>.</para></step>
<step><para>Specify the directory in which the JavaTest test harness will
write the report, and then click <emphasis>OK</emphasis>.</para><para>A report
is created, and you are asked whether you want to view it.</para></step>
<step><para>Click <emphasis>Yes</emphasis> to view the report. </para></step>
</procedure>
</task>
<task id="GBFWK"><title>To Run a Subset of Tests in Command-Line Mode</title>
<procedure>
<step><para>Change to the directory containing the tests you want to run.</para>
<para>For example, <filename>&lt;TS_HOME>/src/com/sun/ts/tests/signaturetest/saaj
</filename>.</para></step>
<step><para>Start the test run by executing the following command:</para><para><command>
&lt;TS_HOME>/bin/tsant runclient</command></para><para>The tests in <filename>&lt;TS_HOME>/src/com/sun/ts/tests/signaturetest/saaj
</filename> and its subdirectories are run.</para></step>
</procedure>
</task>
<task id="GBFVL"><title>To Run a Subset of Tests in Batch Mode Based on Prior
Result Status</title>
<tasksummary>
<para>You can run certain tests in batch mode based on the test's prior run
status by specifying the <literal>priorStatus</literal> system property when
invoking <command>tsant</command>.</para></tasksummary>
<procedure>
<step><para>Invoke <command>tsant</command> with the <literal>priorStatus</literal> property.
</para><para>The accepted values for the <literal>priorStatus</literal> property
are any combination of the following:</para>
<itemizedlist>
<listitem><para><literal>fail</literal></para></listitem>
<listitem><para><literal>pass</literal></para></listitem>
<listitem><para><literal>error</literal></para></listitem>
<listitem><para><literal>notRun</literal></para></listitem>
</itemizedlist>
<para>For example, you could run all the &TechnologyShortName; tests with
a status of failed and error by invoking the following commands:</para>
<literallayout><command>cd $TS_HOME/src/com/sun/ts/tests/signaturetest</command>
<command>$TS_HOME/bin/tsant -DpriorStatus="fail,error" runclient</command></literallayout>
<para>Note that multiple <literal>priorStatus</literal> values must be separated
by commas.</para></step>
</procedure>
</task>
</sect1>
<sect1 id="GBWKD"><title>Building/Deploying/Running &TCKShortName; Tests Using <filename>
tsant</filename></title>
<para>You can use <filename>tsant</filename>, an implementation of Ant bundled
with the &TCKShortName;, to build, deploy, and run the test suite.</para>
<task id="GBWKI"><title>To Configure Your Build Environment</title>
<procedure>
<step><para>Set the following environment variables in your shell environment
to use the build infrastructure that comes with the TCK:</para>
<substeps>
<step><para><literal>TS_HOME</literal> to the directory in which the &TCKShortName; software
is installed.</para>
<itemizedlist>
<listitem><para><emphasis>C Shell</emphasis></para>
<screen>setenv TS_HOME /path_to_saajtck</screen>
</listitem>
<listitem><para><emphasis>Bourne Shell</emphasis></para>
<screen>TS_HOME=/path_to_saajtck
export TS_HOME</screen>
</listitem>
</itemizedlist>
</step>
<step><para><literal>ANT_HOME</literal> to the directory in which the ANT
software is installed.</para>
<itemizedlist>
<listitem><para><emphasis>C Shell</emphasis></para>
<screen>setenv ANT_HOME ${TS_HOME}/tools/ant</screen>
</listitem>
<listitem><para><emphasis>Bourne Shell</emphasis></para>
<screen>ANT_HOME=${TS_HOME}/tools/ant
export ANT_HOME</screen>
</listitem>
</itemizedlist>
</step>
<step><para><literal>TS_HOME/bin</literal> to your <literal>PATH</literal> in
your command shell.</para>
<itemizedlist>
<listitem><para><emphasis>C Shell</emphasis></para>
<screen>setenv PATH ${TS_HOME}/bin:${PATH}</screen>
</listitem>
<listitem><para><emphasis>Bourne Shell</emphasis></para>
<screen>PATH=${TS_HOME}/bin:${PATH}
export PATH</screen>
</listitem>
</itemizedlist>
</step>
<step><para><literal>JAVA_HOME</literal> to the directory in which the &J2SEversion; software
is installed.</para>
<itemizedlist>
<listitem><para><emphasis>C Shell</emphasis></para>
<screen>setenv JAVA_HOME /path_to_jdk15</screen>
</listitem>
<listitem><para><emphasis>Bourne Shell</emphasis></para>
<screen>JAVA_HOME=/path_to_jdk15
export TS_HOME</screen>
</listitem>
</itemizedlist>
</step></substeps>
</step>
<step><para>Change to the <filename>&lt;TS_HOME>/install/saaj</filename> directory
and run ant to create and set up your <filename>&lt;TS_HOME>/bin</filename> directory
if it has not yet been set up.</para></step>
<step><para>Change to the <filename>&lt;TS_HOME>/bin</filename> directory
and edit the <filename>ts.jte</filename> file to set the required properties
needed for using Ant build environment.</para>
<substeps>
<step><para><literal>webserver.home</literal> to the directory in which the
Java Web Services Developers Pack is installed.</para></step>
<step><para><literal>webserver.host</literal> to the host on which the Web
server is running.</para></step>
<step><para><literal>webserver.port</literal> to the port on which the Web
server is running.</para></step>
<step><para><literal>webserver.container<?Pub Caret></literal> to supported
web container used for testing.</para></step></substeps>
</step>
</procedure>
</task>
<task id="GBWJL"><title>To Build the Tests</title>
<procedure>
<step><para>To build a single test directory, type the following:</para>
<screen>cd &lt;TS_HOME>/src/com/sun/ts/tests/saaj/api/javax_xml_soap/AttachmentPart
tsant clean build</screen>
<para>This cleans and builds the tests in the <filename>AttachmentPart</filename> test
directory.</para></step>
<step><para>To list the classes directory for this test that was built, type:</para>
<screen>tsant lc</screen>
<para><emphasis>or</emphasis></para>
<screen>tsant llc</screen>
</step>
<step><para>To list the distribution directory of archives for this test that
was built, type:</para>
<screen>tsant ld</screen>
<para><emphasis>or</emphasis></para>
<screen>tsant lld</screen>
</step>
<step><para>To build a subset of test directories, type:</para>
<screen>cd &lt;TS_HOME>/src/com/sun/ts/tests/saaj/api
tsant clean build</screen>
<para>This cleans and builds all the test directories under the <filename>api</filename> directory.
</para></step>
</procedure>
</task>
<task id="GBWJO"><title>To Deploy the Tests</title>
<procedure>
<step><para>To deploy a single test directory, type the following:</para>
<screen>cd &lt;TS_HOME>/src/com/sun/ts/tests/saaj/api/javax_xml_soap/AttachmentPart
tsant deploy</screen>
<para>This deploys the WAR file built for the <filename>AttachmentPart</filename> test
directory to the <filename>webapps</filename> directory.</para></step>
<step><para>To deploy a subset of test directories, type:</para>
<screen>cd &lt;TS_HOME>/src/com/sun/ts/tests/saaj/api
tsant deploy</screen>
<para>This deploys all the test WAR files for the <filename>api</filename> directory.
</para></step>
</procedure>
</task>
<task id="GBWJZ"><title>To Run the Tests</title>
<procedure>
<step><para>To run a single test directory, type the following: </para>
<screen>cd &lt;TS_HOME>/src/com/sun/ts/tests/saaj/api/javax_xml_soap/AttachmentPart
tsant runclient</screen>
<para>This runs all tests in the <filename>AttachmentPart</filename> test
directory.</para></step>
<step><para>To run a single test within a test directory, type:</para>
<screen>cd &lt;TS_HOME>/src/com/sun/ts/tests/saaj/api/javax_xml_soap/AttachmentPart
tsant runclient -Dtest=getMimeHeader1Test</screen>
<para>This runs only the <filename>getMimeHeader1Test</filename> in the <filename>
AttachmentPart</filename> test directory. You select the test name to run
by looking at the <literal>testName</literal> tags in the <filename>URLClient.java
</filename> file.</para></step>
<step><para>To run a subset of test directories type:</para>
<screen>cd &lt;TS_HOME>/src/com/sun/ts/tests/saaj/api
tsant runclient</screen>
<para>This runs all the test directories under the <filename>api</filename> directory.
</para></step>
</procedure>
</task>
</sect1>
<sect1 id="GBFVK"><title>Test Reports</title>
<para>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.</para>
<para>To see all of the HTML report files, enter the URL of the <filename>report.html
</filename> file. This file is the root file that links to all of the other
HTML reports.</para>
<para>The JavaTest harness also creates a <filename>summary.txt</filename> file
in the report directory that you can open in any text editor. The <filename>summary.txt
</filename> file contains a list of all tests that were run, their test results,
and their status messages.</para>
<sect2 id="GBFWD"><title>Creating Test Reports</title>
<task id="GBFVH"><title>To Create a Test Report in GUI Mode</title>
<procedure>
<step><para>Click <emphasis>Report->Create Report</emphasis> from the JavaTest
main menu.</para><para>You are prompted to specify a directory to use for
your test reports. The default location is <filename>&lt;TS_HOME>/src/com/sun/ts/tests/signaturetests/saaj
</filename>.</para></step>
<step><para>Specify the directory you want to use for your reports, and then
click <emphasis>OK</emphasis>.</para><para>Use the <emphasis>Filter</emphasis> drop-down
list to specify whether you want to generate reports for the current configuration,
all tests, or a custom set of tests.</para><para>You are asked whether you
want to view report now.</para></step>
<step><para>Click <emphasis>Yes</emphasis> to display the new report in the
JavaTest ReportBrowser.</para></step>
</procedure>
</task>
<task id="GBFVC"><title>To Create a Test Report in Command-Line Mode</title>
<procedure>
<step><para>Specify where you want to create the test report.</para>
<substeps>
<step><para>To specify the report directory from the command line at runtime,
use:</para>
<literallayout><command>&lt;TS_HOME>/bin/tsant -Dreport.dir="&lt;report_dir>"</command></literallayout>
<para>Reports are written for the last test run to the directory you specify.
The default location is <filename>&lt;TS_HOME>/src/com/sun/ts/tests/signaturetests/saaj
</filename>.</para></step>
<step><para>To specify the default report directory, set the <literal>report.dir</literal> property
in <filename>&lt;TS_HOME>/bin/ts.jte</filename>.</para><para>For example, <literal>
report.dir="/home/josephine/reports"</literal>.</para></step>
<step><para>To disable reporting, set the <literal>report.dir</literal> property
to <literal>"none"</literal>, either on the command line or in <filename>ts.jte</filename>.
</para><para>For example:</para>
<literallayout><command>&lt;TS_HOME>/bin/tsant -Dreport.dir="none"</command></literallayout>
</step></substeps>
</step>
</procedure>
</task>
</sect2>
<sect2 id="GBFVB"><title>Viewing an Existing Test Report</title>
<task id="GBFVO"><title>To View an Existing Report in GUI Mode</title>
<procedure>
<step><para>Click <guimenu>Report->Open Report</guimenu> from the JavaTest
main menu.</para><para>You are prompted to specify the directory containing
the report you want to open.</para></step>
<step><para>Select the report directory you want to open, and then click <emphasis>
Open</emphasis>.</para><para>The selected report set is opened in the JavaTest
ReportBrowser.</para></step>
</procedure>
</task>
<task id="GBFWB"><title>To View an Existing Report in Command-Line Mode</title>
<procedure>
<step><para>Use the Web browser of your choice to view the <filename>report.html</filename> file
in the report directory you specified from the command line or in <filename>ts.jte
</filename>.</para></step>
</procedure>
</task>
</sect2>
</sect1>
</chapter>
<?Pub *0000016176 0>
