Examples of Using Batch Files

The following examples demonstrate how a batch file that specifies a local host and the tests is used in a command line to change the configuration used to run tests.

Example of a Batch File

The following commands included in a text file named mybatchfile.jtb override the localHostName value and the tests specified in the configuration file. See Setting Specific Configuration Values for detailed information about the set command. See Specifying Tests to Run for detailed information about the tests command.

The following text is a note
Batch files use the "Single String Arguments Format." The -set and -tests commands are not used in the batch file.

Example:

#File sets localHostName and tests
set jck.env.runtime.net.localHostName mymachine;
tests api/javax_swing api/java_awt

Before a value can be changed from the command line, it's tag-name must exist in the initialized configuration file. If the configuration does not include the tag-name (for example, jckdate.gmtOffset) you must use the Configuration Editor in the JavaTest GUI to add or replace it.

See Obtaining the Question tag-name for detailed information about the tag-name for the question.

Command Line Using mybatchfile.jtb

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 [jt_dir/lib/]javatest.jar -batch -testsuite mytestsuite.ts -workdir myworkdir.wd -open myconfig.jti @mybatchfile.jtb -runtests

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

Changing Values After a Batch File is Set

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

Batch Options Example:
java -jar [jt_dir/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 [jt_dir/lib/]javatest.jar -batch "testsuite mytestsuite.ts; workdir myworkdir.wd; open myconfig.jti; @mybatchfile.jtb; exclude myexcludelist.jtx; runtests"