Run Method
Description
Runs the open test or business component and creates results in the specified file or ALM path.
Syntax
Visual Basic
Public Sub Run( _
   Optional ByVal ResultsOptions As RunResultsOptions = 0, _
   Optional ByVal WaitOnReturn As Boolean = True, _
   Optional ByVal Parameters As Parameters = 0 _
) 
Parameters
ResultsOptions
If no RunResultsOptions object is specified, the default value for the RunResultsOptions object is used (the results are saved in a unique folder within the test's or component's folder).

WaitOnReturn
Indicates whether the Test.Run statement waits until the end of the of the run before performing the next statement in the automation script.  Default=True.

Note: Set this property to False only if the steps following the Test.Run statement can be performed even while the test or component is running.

Parameters
The Parameters collection containing the values you want to pass to the test or component.
Remarks
Note: When you run a test or business component using automation, it always runs in silent mode (whether UFT One is visible or minimized). This means that that even if UFT One is visible, message boxes are not opened during the run session. In addition, the test does not stop at breakpoints inserted in the test.
Example
'************************************************************************************************************************
'Description:
'
'This example opens a test with predefined parameters,
' gets a collection of parameter definitions, Loops on it and display each parameter details,
' gets a collection of run-time parameters, change the value of one of them, run the test with parameters,
' after the test run - display the value of one of the out parameters.
'
'Assumptions:
' the test D:\Tests\Mytest contain in parameter called "InParam1" and out parameter called "OutParam1"
'************************************************************************************************************************

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim pDefColl 'As QuickTest.ParameterDefinitions ' Declare a Parameter Definitions collection
Dim pDef ' As QuickTest.ParameterDefinition ' Declare a ParameterDefinition object
Dim rtParams 'As QuickTest.Parameters ' Declare a Parameters collection
Dim rtParam ' As QuickTest.Parameter ' Declare a Parameter object
'Dim cnt, Indx As Integer

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start UFT One
qtApp.Visible = True ' Make the UFT One application visible

qtApp.Open "D:\Tests\MyTest"

' Retrieve the parameters collection defined for the test.
Set pDefColl = qtApp.Test.ParameterDefinitions
cnt = pDefColl.Count
Indx = 1

' Display the names and values of each of the parameters in the collection.
While Indx <= cnt
    Set pDef = pDefColl.Item(Indx)
    MsgBox "Param name: " & pDef.Name & "; Type: " & pDef.Type & "; InOut: " & pDef.InOut & "; Description: " _
        & pDef.Description & "Default value: " & pDef.DefaultValue
    Indx = Indx + 1
Wend

Set rtParams = pDefColl.GetParameters() ' Retrieve the Parameters collection defined for the test.

Set rtParam = rtParams.Item("InParam1") ' Retrieve a specific parameter.
rtParam.Value = "Hello" ' Change the parameter value.

qtApp.Test.Run , True, rtParams ' Run the test with changed parameters.

MsgBox rtParams.Item("OutParam1").Value ' Display the value of an output parameter after the test runs.
Example
See Also