This document is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License
  Previous Contents Index Next
Appendix E

Running a Single Test From Command Line

The JCK tests can be run from command line, which can be helpful for debugging purposes.

The JCK-runtime, JCK-compiler, and JCK-devtools test suites include sample UNIX shell scripts that show you how the tests are executed. To install shell scripts along with JCK, specify -install shell_scripts option during the installation. After the installation, the scripts are located in the test source directories - one script per test description. The purpose of the sample scripts is to show what information is required to run a test in a debugger or from a command line:

  • what value should classpath contain

  • which class should be run

  • what arguments need to be passed

All configuration information is stored in the .html files in TestDescription tables. JavaTest Harness reads TestDescription and runs the test accordingly. When a test requires a configuration parameter, JavaTest takes its value from interview answers. Provided scripts show how the JavaTest Harness runs the test. For most configuration parameters, the typical value that suits most configurations is used. For other parameters, like network configuration where values can vary from system to system, the values must be set prior to script execution.

E.1 Running Scripts

Scripts can be run with a shell interpreter that is compatible with UNIX Korn shell. Scripts can be also run on a Windows system with MKS toolkit. In examples below 'sh' is used as shell interpreter. On some platforms 'ksh' should be used instead. Note that you need to set JAVA_HOME environment variable pointing to Java Implementation under test prior to script execution.

Example E-1 Setting JAVA_HOME variable

# export JAVA_HOME=/opt/java6

Example E-2 Running scripts from a Command Line

# sh tests/api/java_lang/Package/index_Package.ksh


# cd tests/api/java_lang/Package

# sh index_Package.ksh

Example E-3 Running scripts located outside the JCK directory

When script modification is required, the script file can be copied to another location, modified and run from there. To run a script located outside of the JCK install directory, set the TCK_HOME environment variable to point to JCK location.

# cp /jck/JCK-runtime-6b/tests/api/java_lang/Package/index_Package.ksh /tmp

# export TCK_HOME=/jck/JCK-runtime-6b

# sh /tmp/index_Package.ksh

Example E-4 Running scripts that use default working directory

Some tests create temporary files in the work directory. /tmp/jck-workdir is used as the default work directory. The directory is created automatically and after script execution, contains files created by tests.

# sh tests/api/java_io/FileWriter/index_FWFlushTest.ksh

/tmp/jck-workdir is created

Example E-5 Running scripts with specified working directory

Work directory can be defined by setting TESTWORKDIR variable.

# export TESTWORKDIR=/tmp/FileWriter

# sh tests/api/java_io/FileWriter/index_FWFlushTest.ksh

/tmp/FileWriter is created

Example E-6 Running scripts with configuration parameters

There are scripts that require extra configuration parameters. These parameters should be set in the environment variables.

# export NETWORK_LOCALHOST=myhost/

# export NETWORK_TESTHOST1=neighbour.domain/

# sh tests/api/java_net/InetAddress/index_ToString.ksh

E.1.1 Hints for Running Scripts on a Windows System

Note - Make sure MKS toolkit is installed before running the scripts.

  • For all tests

    Before running the script make sure that an environment variable that specifies the classpath, like CLASSPATH, ClassPath, etc is not set in the system. You can use the following commands to unset the selected environment variable:

    #> env | grep -i classpath

    #> unset ClassPath

  • For those tests that require a workdir to create temporary files, like compiler or devtools tests:

    By default /tmp/jck-workdir directory is used for creating temporary files. If there is a problem creating such directory, TESTWORKDIR environment variable should to be set prior test script execution as follows:

    #> set TESTWORKDIR=C:/tmp


    #> set TESTWORKDIR=C:\\tmp

  • For devtools tests

    All devtools tests use one of four wrapper scripts to run schema compiler, schema generator, wsimport or wsgen tool. JCK-devtools test suite provides shell scripts for Solaris and Linux, and bat scripts for Windows. Solaris versions are used by default. To be able to run the test execution scripts under Windows platform, the similar shell scripts need to be provided, and path to them should be set via environment variables as shown below. SHELL variable should also be set:

    #> set SHELL=sh
    #> set TESTWORKDIR=C:/tmp
    #> set WSIMPORT=C:/jck-devtools/
    #> set WSGEN=C:/jck-devtools/
    #> set XJC=C:/jck-devtools/
    #> set SCHEMAGEN=C:/jck-devtools/

    Refer to 5.11 JAX-WS Mapping Tests, 5.29 Schema Compiler, and 5.30 Schema Generator chapters for details on the wrapper scripts.

Previous Contents Index Next
Company Info Contact Terms of Use Privacy Copyright 1994-2008 Sun Microsystems, Inc.