Using a Batch File

You can place routinely used configuration settings in a "batch file" and then use it in additional or repeated test runs.

When you use the -batch mode option and its commands to configure and run tests, write test reports, and audit test results (either from the command line or as a part of a product build process), you can use a .jti file as a standard template and a batch file to modify specific configuration values before running tests.

The commands used in a batch file with -batch are a formatted set of commands, executed in the sequence that they appear in the command string. Use the commands in the batch file as you would if you were writing a script. See Formatting Batch Commands for a description of the formats you can use.

Example of Using a Batch File

In a text file named "mybatchfile.jtb" is the following (-set is only used on the command line):

set jck.env.runtime.net.localHostName mymachine; tests api/javax_swing api/java_awt

To change a value by using the set option, the question tag-name name must be in your current interview path. To view the current interview path, open your .jti file in the Configuration Editor. If your current interview path does not include jck.env.runtime.net.localHostName you must either add it to the interview path or replace it in the batch file with a tag-name and value that is in the path. See Obtaining the Question tag-name for detailed information about the tag-name for the question.

In the following examples, a test suite (mytestsuite.ts), work directory (myworkdir.wd), and .jti file (myconfig.jti) are opened, and the batch file (mybatchfile.jtb) is read and executed before running tests.

The following text is a note
To run the following examples you must replace mytestsuite.ts, myworkdir.wd, and myconfig.jti with test suite, work directory, and .jti names that exist on your system. Win32 users must also change "/" file separators to "\" to run these examples.

Batch Options Example:
java -jar lib/javatest.jar -batch -testsuite mytestsuite.ts -workdir myworkdir.wd -open myconfig.jti @mybatchfile.jtb -runtests

Single String Arguments Example:
java -jar lib/javatest.jar -batch "testsuite mytestsuite.ts workdir myworkdir.wd open myconfig.jti; @mybatchfile.jtb; -runtests"

You can also change values after the batch file is set:

Batch Options Example:
java -jar lib/javatest.jar -batch -testsuite mytestsuite.ts -workdir myworkdir.wd -open myconfig.jti @mybatchfile.jtb -exclude myexcludelist.jtx -runtests

Single String Arguments Example:
java -jar lib/javatest.jar -batch "testsuite mytestsuite.ts workdir myworkdir.wd open myconfig.jti; @mybatchfile.jtb; exclude myexcludelist.jtx; runtests"