The Expression Designer helps you quickly create expressions that enhance the functionality of a visual test. An expression is a combination of local variables, reserved variables, ActiveData assets, operators, and functions that return a string or number in either a local variable or in an ActiveData asset.
For example, to test an application that requires ten different order numbers, you can create an expression that increments the value of a variable and returns a unique order number:
You can then use this expression in a repeat loop and run the loop multiple times. For each iteration of the loop, the order number increments by one and the expression returns a unique order number stored in the local variable OrderNumVar.
You can also include ActiveData fields in an expression by specifying an ActiveData column in an expression, and then setting up repetition logic that repeats a sequence of steps using every value in the ActiveData column. For example, you can create an expression that returns only a specified portion of an ActiveData column value such as the values displayed in the following ADDRESS column:
|Anytown, USA 12345|
|Anycity, USA 23456|
|Anyplace, USA 34567|
|Anywhere, USA 45678|
To return only the zip code in the ADDRESS column, you can create an expression that includes the ActiveData column "ADDRESS" and the string function Right, which returns a specified number of characters from the right side of a string:
localVar = Right (ActiveDataAssetName("ADDRESS"),5)
This expression returns the last 5 characters from the right side of the string and stores the return value in localVar ("12345" in this example). To iterate through the rows of the ActiveData file and return each of the zip codes in the above column, you can set up repetition logic to repeat the expression step using each of the values in the column.
In addition to the string function Right, the Expression Designer supports a number of other functions and operations.