In the test description file, $testHost and $testPort are test environment variables and are replaced by actual values obtained from the test environment.

The test suite configuration interview must include a corresponding and appropriate question asking the user to specify the values of the host and port number.

The configuration interview creates entries in the test environment from user answers as name-value pairs. The value of $testHost and $testPort are defined in the configuration from those user answers. Users can display the test environment from within the harness by choosing Configure > Show Test Environment from the Test Manager menu bar.

The following is an example of name-value pairs that the configuration interview might create in a configuration file from user answers.

testHost=129.42.1.50

testPort=8080

To Create a Configuration Interview Through the Interview Class

The following procedure uses the Test2.java test class as an example to demonstrate how to accomplish the following tasks:

Create a configuration interview through the interview class

Export an environment variable

Specify the environment value by using context or executeArgs

Decode the argument into the test class

SimpleTestSuite/tests/sample/pkg2/Test2.java is a simple test class created to demonstrate the basic principle of writing a test that uses a configuration interview.

In addition to the procedures provided in this section, refer to Chapter 6 of the JavaTest Architect’s Guide for additional information regarding creating configuration interviews.

Chapter 3 Test Suite Construction 29

Page 49
Image 49
Sun Microsystems 1.2 manual TestHost=129.42.1.50 TestPort=8080