Using Parameters Passed From a Visual Test in Another Visual Test

You can pass the output parameters of a visual test to other visual tests that call this visual test. We will refer to the calling visual test as the host test and to the called visual test as the child test. To use the parameters of a child test in a host test, assign the output parameters of the child test to local variables in the host test.

  1. Open the host test.
  2. Create a local variable for each output parameter of the child test that you want to pass to the host test. For additional information, see Adding Local Variables to a Visual Test.
  3. In the Test Steps pane, select the step that executes the child test. The step text looks similar to Playback visual test 'asset name', where 'asset name' is the name of the child test.
  4. In the Properties pane for the step, expand the Output parameters category. The names of the output parameters of the child test display in the Output parameters subcategories. If the parameters do not display in the Properties pane, click the Name text box, and then click Update Parameter Names.
  5. Click the text box of an output parameter name and select the appropriate local variable from the list.
  6. Repeat the preceding step for each output parameter of the child test that you want to pass to the host test.
  7. Optional: To see the values of the output parameters that are passed from the child test to the host test, insert a result comment step for each parameter into the host test.
    1. In the host test, right-click on the step after which you want to insert a result comment. For example, click on the step that calls the child test.
    2. Select Insert > Result Comment.
    3. In the properties of the new step, click into the Expression text field.
    4. Click Select.
    5. Select Variable from the list. The Select a variable dialog box opens.
    6. Select the variable that corresponds to the output parameter of the child test.
  8. Modify the appropriate test steps in the host test to include the local variable.
    1. Select the step in the Test Steps pane.
    2. In the Properties pane, expand the Parameters section.
    3. Click into the text box that corresponds with the property type of the local variable. For example, if the local variable is of the type text, and you want to change a test step that types text into a text field in the AUT, click into the keys text box, which also is of the type text.
    4. Click Select, and then select Variable. The Select a Variable dialog box opens.
    5. Select the local variable that you want to use, and then click OK.
If the child test has been included for playback in the host test and its input and output parameters have been defined correctly, the child test can now be played back and parameters are successfully passed between the child test and the host 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.