Specifying a Work Directory (workdir or workdirectory)

Each work directory is associated with a test suite and stores its test result files in a cache. You can use the work directory command to:

See Shortcuts to Initialize a Configuration for information about specifying a work directory in the command line.

Use an Existing Work Directory

To use an existing work directory for the test run, include either the workdir or workdirectory command in the command line:

> javatest ... -workdir path/filename ... [task command] ...

See About the Command-Line Examples for a description of the use of > javatest in the example.

See Command-Line Overview for a description of the command line structure.

See Formatting a Command for descriptions and examples of the following command formats.

Create a New Work Directory

To create a new work directory for the test run, use the -create command option:

> javatest ... -workdir -create path/filename [configuration command] ... [task command] ...

See About the Command-Line Examples for a description of use of > javatest in the example.

The new work directory must not previously exist. You can also use an existing work directory as a template to create a new work directory for the test run. To use an existing work directory as a template, put the template in the command line before the create command.

When creating the command string, include the commands in the following sequence:

  1. Specify the test suite (optional)
  2. Specify an existing work directory (optional)
  3. Include the workdir or workdirectory -create path/filename command
  4. Specify a configuration file
  5. Set specific values (optional)
  6. Include the runtests command (optional). The results of the test run are written to the new work directory.

See Command-Line Overview for a description of the command line structure.

Detailed Example of Creating a New Work Directory

In the following example, myworkdir.wd and myconfig.jti represent file names that might exist on your system.

Command Options Format Example:

> javatest -workdir myworkdir.wd -create testrun.wd -config myconfig.jti -runtests

When the tests are run, the JavaTest harness uses the work directory (testrun.wd) created by the command line, even if the configuration file (myconfig.jti) was created using another work directory.

See Formatting a Command for descriptions and examples of other command formats that you can use.

Replace an Existing Work Directory

When you replace an existing work directory with a new work directory, the JavaTest harness:

  1. Deletes the existing work directory and its contents.
  2. Creates the new work directory using the same name (if the old directory was successfully deleted).

To replace an existing work directory with a new work directory, use the -overwrite command option.

> javatest ... -workdir -overwrite path/filename ... [task command] ...

or

> javatest ... -workdir -create -overwrite path/filename ... [task command] ...

The -create command option is optional when the -overwrite command is used.

See About the Command-Line Examples for a description of use of > javatest in the examples.

See Command-Line Overview for a description of the command line structure.

Detailed Example of Replacing an Existing Work Directory

In the following example, myconfig.jti represents a configuration file name that might exist on your system.

Command Options Format Example:

> javatest -workdir -overwrite testrun.wd -config myconfig.jti -runtests

The JavaTest harness uses the work directory testrun.wd created by the command line when the tests are run, even if myconfig.jti was created using another work directory.

See Formatting a Command for descriptions and examples of other command formats that you can use.