In the Test Data Table view of the test suite editor, you
can reference environment variables in the test data table.
Procedure
- In the test suite editor, click the Test Data
Table tab. The Test Data Table view opens.
- In the Test Data Table view, click the Default tab
(or the tab of another test variation) to display the test data table.
- In the Name column of the test data table, locate the name of the field for which you want to reference an environment variable. The field must have a simple data type, such as string or integer. The field must also have a literal format and cannot be specified in a Java™ expression.
- In the row that contains the field name, type the environment
variable that you want to reference in either the Set column
or the Expected column and then press Enter.
By default, the format is literal. Alternatively, you can right-click
the root (top level) of the environment variable in the Name column
and select Set Format > XML, then double-click
the XML string in the Set or Expected column
to open the XML editor and type the environment variable. Regardless
of which approach you use, you can reference one of the following
three types of environment variables:
| Environment variable type |
Description |
| Proprietary |
These environment variables are referenced in the test suite
editor or the test client, but they are generally defined in the test
client, Component Test Explorer, or by using command-line invocation.
The syntax for these environment variables is: ${proprietary_variable_name}
For
example:
${MY_VAR}
|
| WebSphere® Application Server |
These environment variables are defined in the server Administrative
Console and referenced in either the test data table or the test client.
The syntax for these environment variables is: $WAS{WAS_variable_name}
For
example:
$WAS{INSTALL_ROOT}
|
| JVM property |
These environment variables are defined in the server Administrative
Console and referenced in either the test data table or the test client.
The syntax for these environment variables is: $JVM{JVM_property_name}
For
example:
$JVM{file.encoding}
|
If you want, you can concatenate different types of environment
variables using a forward slash (/) character. For example:
$WAS{INSTALL_ROOT}/${MY_LOG_DIR_NAME}
- If you are referencing an environment variable that will
not have a value defined at run time, you can specify a default value
for the environment variable in the test data table. For example:
${MY_VAR, customer}
In the example, the default value customer is
specified. If the environment variable is not defined at run time,
it will be substituted by the string customer.
Note: If
your test data table contains environment variables and you plan to
export the data table to an XML file, you need to exercise caution.
Environment variables that are referenced in the test data table are
generally defined at run time rather than in the data table, which
means that they will be exported from the data table to the XML file
"as is" with only a name and without any defined value. However, if
you have specified a default value for the environment variable in
the data table, it will be exported to the XML file with the defined
value.
- Save the test suite.
What to do next
Regardless of the tool that you plan to use to perform your testing, the next step is to define values for your environment variables. If you have referenced JVM or WebSphere Application Server environment variables in the data table, you typically need to define the values in the server administrative console. If you have referenced proprietary environment variables in the data table, you can define the values in the integration test client, or in the Component Test Explorer, or by using command-line invocation. Information about defining values for proprietary environment variables is found in the following topics:
- Defining environment variable values in the test client
- Running test projects, suites, and cases in the Component Test
Explorer
- Defining environment variables for command-line invocation
This topic only applies to BAW, and is located in the BAW repository. Last updated on 2025-01-20 10:38