Creating a Local Variable to Store Application Data

Variables enhance visual tests by providing the ability to store data values for use in other parts of the test or in other visual tests or scripts. Data can also be output to other types of files.

In this lesson, you will store variable text in the control that displays the email address so it can be used in a later lesson of the tutorial. To do this, you must first create a local variable to store the text.

  1. In the Test Steps pane, click Actions > Insert > Variable > Add Local. The Add Local Variable dialog box opens.
  2. In the Variable name text box, type strEmailAddress.
  3. From the Type list, select Text. Leave the Initial value text box empty for this lesson, since a value will be stored to the variable in a subsequent lesson. The Text type stores the variable value as a text, or string data type.
  4. Click OK. The new variable is saved for the visual test. Once the variable is created, you can see it and edit its definition from the <<Start>> step.
  5. To view the strEmailAddress variable, select the <<Start>> step in the Test Steps pane.
    Tip: The <<Start>> step is always the first step in any visual test.

    Properties for the step display in the Properties pane. With the <<Start>> step selected, strEmailAddress displays in the Variables category defined as a Text variable.

The value area for the variable types indicate the number of variables of the type that are currently defined. In this lesson, one Text variable has been created, so the value area for the item shows that one item is associated with this test.

Now that you have created the local variable to store the quote email address, store the email address text from the application to the variable.