You can use the -batch
mode option and its commands to edit a configuration either from the command line as part of a batch process or as a part of a product build process. The commands used with -batch
are a formatted set of commands, executed in the sequence that they appear in the command string. See Formatting Batch Commands for a description of the formats you can use.
The following are provided as examples of how editing can be accomplished in batch mode:
Use the commands in the command string as you would if you were writing a script.
You can import a site specific .jti
file (as a template) and then set specific configuration values before running tests.
In the following examples, a test suite and work directory are opened, a .jti
file (myconfig.jti
) is imported, and the host name in the .jti
file is changed to "mymachine" before running tests. The test suite (mytestsuite.ts
) and existing work directory (myworkdir.wd
) must be compatible.
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.
You must also replace jck.env.runtime.net.localHostName
and its value with a question tag-name and value in your current interview path. From the command line, you can only change values in your current interview path. See Obtaining the Question tag-name for detailed information about the tag-name for the question.
Batch Options Example:
java -jar lib/javatest.jar -batch -testsuite mytestsuite.ts -workdir myworkdir.wd -open myconfig.jti -set jck.env.runtime.net.localHostName mymachine -runtests
Single String Arguments Example:
java -jar lib/javatest.jar -batch "testsuite mytestsuite.ts workdir myworkdir.wd open myconfig.jti; set jck.env.runtime.net.localHostName mymachine; runtests"
You can only change configuration values in the current interview path of the .jti
file. If you change a value that is not in the current interview path the JavaTest harness displays a error message. You can view the current interview path in the Configuration Question Log or in the Configuration Editor All Values view.
You can open an existing work directory (as a template) and then use it to create a new work directory for the the test run before running tests.
In the following examples, a test suite (mytestsuite.ts
) and work directory (myworkdir.wd
) are opened, and a new work directory (testrun.wd
) is created before running tests. The results of the test run are written to the new work directory.
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 -create testrun.wd -open myconfig.jti -runtests
Single String Arguments Example:
java -jar lib/javatest.jar -batch "testsuite mytestsuite.ts workdir myworkdir.wd; create testrun.wd; open 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.