Adding Local Variables to a Visual Test

Local variables are variables created for use within a visual test. They are defined in the <<Start>> step of a visual test, edited in the Properties window, and are available to the visual test during playback. Once local variables are created, they are available to the visual test in which they are created.

  1. Open the visual test to which you want to add local variables.
  2. Choose Insert > Variable > Add Local. The Add Local Variable dialog box opens.
  3. Type a name for the variable into the Variable name field. Valid characters for local variable names are uppercase and lowercase alphanumeric characters and the underscore ("ABC", "abc", "_"). Additionally, local variable names must be unique.
    Note: Variable names cannot begin with "st_".
    Silk Test Workbench informs you if a variable name which is being added or edited is a duplicate variable name. If this happens, you must supply a unique name for the variable being added or edited.
  4. Select a type for the variable from the Type list. When adding or editing local variables, the displayed data type is based on the data of the variable being added using the properties window for the <<Start>> step. When storing formula results, select the type from the list.
    Silk Test Workbench supports the following variable types:
    The variable's value is a text string. Text type values can contain letters, numbers, spaces, and punctuation.
    Note: The text data type is case sensitive, which means the cases of the individual characters in the text string must match during comparison. If the cases do not match, the comparison fails.
    Number (Long)

    The variable's value is a number ranging from -2,147,483,648 to 2,147,483,647. Periods (for a fractional/decimal value) cannot be used.

    Number (Double)

    The variable's value is a double-precision floating-point number, and is stored as a 64-bit number in the range -1.7E308 to +1.7E-307.

    Boolean (True/False)

    The variable's value is either True or False.

    Number (Long Long)

    A 64-bit integer value that can have a value in the range -9223372036854775808 to 9223372036854775807.


    This variable groups together a set of values and orders them sequentially from 1 to n. You declare an enumerated type when you want a variable to hold only a limited number of distinct values. Use this variable type with properties or variables that expect an enumeration data type.

    An enumeration stores the numeric value in a 64-bit integer in the range -9223372036854775808 to 9223372036854775807. However, the engine only supports 32-bit enumerations, while the UI supports 64-bit enumerations (in future releases, the engine will support 64-bit enumerations).

  5. Optional: Type an initial value for the variable into the Initial value field. The value can be changed in a visual test or script if passed to a script. The value must be consistent with type. For example, if the type is number (long), the initial value cannot contain characters that are not integers, such as text characters. For boolean variable types, select False or True from the list. Initial values are not required for variables, so this field can be left blank. The value can be determined elsewhere in a visual test.
  6. Click OK. The variable's name and initial value (if any) display under the selected variable type in the Properties pane for the <<Start>> step.
  7. Repeat the preceding step to create other local variables as needed. The value area for the variable types indicate the number of variables of the type that are currently defined. For example, if the value area for the Number(Long) item is 3 Items, there are three local variables currently defined for the visual test that are of the Long data type.