Passing Data Between Scripts and Visual Tests

Both visual tests and scripts can be used in the same testing solution. Each has certain advantages in an overall testing solution. As such, a testing solution may include both visual tests and scripts. Scripts can be used to perform tasks that are more difficult to perform through visual tests, and vice versa.

To help integrate visual tests and scripts in a testing solution, Silk Test Workbench lets you pass data between scripts and visual tests. This lets you leverage data created in your existing Silk Test Workbench script base, as well as allowing you to use the most efficient testing assets and still retain data integrity within a testing solution. Pass data between scripts and visual tests using script parameters.

Note: To pass data between a visual test and a script, the script must be inserted and played back from within the visual test. To pass data, scripts and visual tests must be in the same project, or the inserted script or visual test must be in a referenced project.
With script parameters, you can:
  • Create data in a visual test and use it in a script.
  • Create data in a visual test, pass it to a script, modify the data in the script, and pass it back to the visual test.
  • Create data in a script and pass it to a visual test.

The process is as follows:

  1. Add input and output parameters to a script.
  2. Insert the script into the visual test.
  3. Pass data from the visual test to the script by editing the value of the input parameter in the visual test.
    Note: The value that you send from the visual test is not saved in the script, but it can be used in computations in the script.
  4. In the visual test, create a local variable to store the data passed from the script output parameter, and then use the local variable within the visual test.
Note: For a detailed example of how to create input and output parameters and use them in a visual test, refer to Playing Back Scripts From Visual Tests in the Welcome to the SilkTest Workbench Visual Test Tutorial.