6.11 Creating Test Variables

Test variables replace test/scenario parameters during test execution. Use these variables in any open text field for scenarios. Also create array-based variables, if necessary.

As an example of using variables, assume an array-based variable allows a scenario to cycle every scenario execution. Assume an HTTP test sets the host field to the {cycle} variable. The values are www.yahoo.com;www.google.com.

Figure 6-2 Variable Element Properties in the Portal View

The first scenario execution results in a HTTP test against www.yahoo.com and the second test against www.google.com. It then cycles back to www.yahoo.com and so on. The event in Operations Center is the same, but the host field changes when each array value executes.

Figure 6-3 Scenario Properties Dialog Box Showing an Array-Based Variable for the Hostname

To define a test variable:

  1. In the Explorer pane, expand the Elements root element > Experience Manager Adapter > Administration > and Test Administration.

  2. Right-click Variables, then click Create Variable to open the Create Variable dialog box:

  3. In the Variable Name text box, type a name for the variable. Enclose the name in brackets: {…}.

  4. In the Variable Value text box, type the name of the variable to replace during test execution.

    For array-based variables, enclose the values in square brackets: […]. Also, delimit the array values by using a semicolon. Incorrect syntax results in not creating the array and using the text itself as the default.

    For example, assume an array-based variable allows a scenario to cycle every scenario execution. Assume an HTTP test has the host field set to the {cycle} variable. The Variable Values are [www.yahoo.com;www.google.com].

  5. Click the Create button.

    The new variable name displays beneath the Variables element in the Explorer pane.

  6. Create a scenario using the variable.

    Assume a HTTP test uses the {type‑var} variable. When creating the test scenario, type {type‑var} in the File Name text box. When the test executes, /index.html is replaced.

  7. Define a test using the variable scenario.

    See Section 6.2, Defining Tests for details.

  8. Deploy the test for a monitor.

    See Section 6.9, Deploying and Managing Tests for details on accessing the Deploy Tests dialog box for a Experience Manager Monitor.

  9. In the Deploy Tests dialog box, select the check box in the Replace Variable column beside a test or group.

    The entire list of variables is made available to the selected text or group.

    If the check box is cleared, the Experience Manager Monitor uses the value and does not substitute the variable.