Executing a Script Within a Visual Test

Visual tests can call and execute existing .NET scripts. This allows a modularized approach to application testing and provides greater control over test execution. When executing a script within a visual test, it is important to remember to keep test site integrity and ensure any test applications being tested are in the correct initial playback state.

You can also use this procedure to create a driver test.

  1. Open the visual test in which you want to insert the script.
  2. Select the test step that precedes where you want the inserted script to execute.
  3. Choose Insert > .NET Script. The Browse for .NET Script dialog box opens.
  4. Select the script to insert and then click OK. Silk Test Workbench inserts a step below the selected step. The inserted step calls and plays back the selected script. The step text is as follows:
    Playback .NET Script 'asset name'

    where 'asset name' is the name of the inserted script.

During playback, when the preceding step executes, the inserted script plays back to completion before the next step in the visual test executes. After a script has been inserted into a visual test, you can edit it and configure the settings used to play it back.

The tested applications are configured, hooked, and started when required, and remain hooked until the end of the playback session. For example, if the visual test has an application configuration for Notepad, and the .NET script has an application configuration for Calculator, the following happens:
  • Notepad is hooked and started when the execution of the visual test starts.
  • Calculator is hooked and started when the execution of the inserted .NET script starts. Notepad remains hooked.
  • Both Notepad and Calculator remain hooked when the execution of the inserted .NET script stops.
  • Both Notepad and Calculator get unhooked when the playback session ends, which means that the execution of the visual test stops.