Updating ActiveData in a Visual Test Using an Expression

You can update data in any ActiveData file associated with a visual test in the visual test. To do this, use the Expression Designer to specify the data and update it. Save updated data to a variable and then use the variable in the visual test, or save it back to the ActiveData file.

  1. In the visual test, create any local variables that you want to use in the expression that you are creating.
  2. In the visual test, associate ActiveData assets whose data columns you want to use in the expression that you are creating.
  3. Select the step that precedes where you want to create the Expression step.
    Tip: You can place expressions that use data from an ActiveData file anywhere in a visual test, including outside of any repetition logic that uses ActiveData. However, if saving data updated in an expression result back to each row in an ActiveData column, this step should be placed immediately after the step that updates the data inside the repetition logic. If the Expression step is placed after the repetition logic, the expression only updates data in the last accessed row of the ActiveData file.
  4. Choose Insert > Expression. The Expression Designer dialog box opens.
  5. Use the Expression Designer dialog box to create an expression that updates data from a column in an ActiveData file. To update ActiveData in a column and put the contents back to the same column, you update the value using the Expression Editor in the Expression Designer dialog box, then put the contents of the expression back to the same column. For example, if you use a column named "Gender" in the data file as input in the Expression Editor, assuming values in the column are string data type and are either "M" or "Fem", the Expression Editor adds "ale" to the data to create "Male" or "Female". That data is then saved back to the same column as shown in the Output section of the dialog box.
  6. After creating and testing the expression, click OK in the Expression Designer dialog box. Silk Test Workbench inserts an Expression: step after the selected step.
    Tip: To edit the expression after creating it, select the Expression: step, then select the Expression property for the step and click Expression Designer to edit the expression using the Expression Designer dialog box.
ActiveData that is updated in an expression is automatically saved back to the ActiveData file upon successful playback completion. However, you can create a step to save updates immediately back to the ActiveData file, or cancel the save so updated data does not get saved.