JavaTest Harness Architect's Guide, JavaTest Harness 4.5 for the Java Platform E20663-03 |
|
Previous |
Next |
Depending on how you design your test suite, you may be able to use the JavaTest harness to compile your tests when building your test suite. The instructions below describe how to compile tests if your test suite uses the Simple Interview and Standard Test Script (StdTestScript
) as described in Chapter 12. To use the JavaTest harness to compile your tests you must:
Specify the source files required to compile them in the tests' test descriptions
Set two system properties on the JavaTest command line
The following table describes the system properties used in compilation:
Table 7-1 System Properties Used in Compilation
System Property | Description |
---|---|
|
Specifies the operating mode used by this configuration. The valid values are: |
certify |
Executes test suite classes (assumes that tests are already compiled) |
precompile |
Compiles the tests |
|
Compiles the tests and runs them |
|
Specifies the command that the JavaTest harness uses to compile the tests. |
These properties are set on the JavaTest command line using the -D
option, usually when running the JavaTest harness in batch mode in a shell script or batch command (see the JavaTest online help for details about batch mode).
You can use the following command lines as templates for compiling the simple test suite you created in Chapter 4:
Windows:
java -DSimpleInterviewParameters.mode=precompile -Dcommand.compile.java='com.sun.javatest.lib.ProcessCommand javac -d $testSuiteRootDir\classes -classpath $testSuiteRootDir\classes $testSource -jar javatest.jar -batch -testsuite ts_dir -workdir -overwrite work_dir -report report_dir
UNIX:
java -DSimpleInterviewParameters.mode=precompile -Dcommand.compile.java='com.sun.javatest.lib.ProcessCommand javac -d $testSuiteRootDir/classes -classpath $testSuiteRootDir/classes $testSource -jar javatest.jar -batch -testsuite ts_dir -workdir -overwrite work_dir -report report_dir
Note: Line breaks are added here to improve readability; your command line should be a single line that contains no line breaks. |
Table 7-2 describes the parts of the command:
Table 7-2 Compilation Command Components
Component |
Description |
The library command used to run processes (in this case the Java compiler) on the same machine as the one the JavaTest harness is running. See for more information about this and other library commands. |
|
|
The JavaTest variable that represents the root directory of the test suite. This value is provided by the JavaTest harness when the command is executed. This value is taken from the path you specify to the |
|
The JavaTest variable that represents the test source file to compile. This value is provided by the JavaTest harness. |
Specifies that the JavaTest harness be executed in "batch" mode. When run in batch mode the JavaTest GUI is not started. See the JavaTest online help for more information. |
|
The fully qualified path name of the top-level test suite directory. |
|
Specifies the name of the work directory to use for the compilation. The |
|
Specifies the name of the directory where reports are to be written. It is best to specify report_dir as a simple file name (no "\" or "/" characters; this causes the reports to be written in work_dir |