Using Parameters Passed From a Script in a Visual Test

Once input and output parameters have been defined for a script, the output parameters can be passed to a visual test that executes the script during its playback. However, to use the passed parameters in the visual test, they must be set to local variables that are stored in the visual test.

  1. Open the visual test.
  2. In the Test Steps pane, select the step in the visual test that executes the script. The step text looks similar to Playback .NET Script 'asset name', where asset name is the name of the inserted script.

    Properties for the step display in the Properties pane. This includes any input and output parameters for the script.

  3. In the Properties pane for the step, expand the Output parameters category. The names of variables defined as output parameters to be passed from the script to the visual test appear in the Output parameters subcategories. These parameters must now be set to local variables created for the visual test. If the parameters do not appear in the Properties pane, reload the script that contains the parameters. To do this, in the Properties pane of the inserted script step, click the Name text box, and then click Update Parameter Names.
  4. Click the text box of an output parameter name in the Properties pane and select the appropriate local variable from the list. This sets the value of the parameter passed from the script to a local variable in the visual test so it can be used in the visual test.
  5. Repeat the preceding step for each output parameter in the Properties pane to be passed to from the script to the visual test.
    Note: To see the values passed from the script to a visual test, insert result comment steps into the visual test. For the comment Expression property, click Select and then choose Variable. Select a local variable from the list that contains the passed value.
  6. In the visual test, modify the appropriate test step to include the local variable. The local variable passes the data from the script output parameter to the test step.
    1. Select the step that you want to use in the Test Steps pane.
    2. In the Properties pane, click the text box for the property that corresponds with the local variable property type. For example, you might click the text text box in the Parameters category.
    3. Click the Select button, and then select Variable. The Select a Variable dialog box opens.
    4. Select the local variable that you want to use, and then click OK. The step text displays as:Enter '[localvariablename]'.
If the script has been included for playback in the visual test and its input and output parameters have been defined correctly, the visual test can now be played back and parameters are successfully passed between the visual test and the script 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.