AddExistingAction Method

Supported in versions 2021 and later.

Description

Adds a call to an existing action from the current action.

Syntax

Visual Basic
Public Function AddExistingAction( _
   ByVal Path As String, _
   ByVal ActionPosition As qtActionPosition _
) As Action

Parameters

Path

The full path to the existing action. It could be a local or ALM path.

ActionPosition

Indicates whether to add the call to the new action as the first or last step in the parent action.

ValueDescription
qtAtBeginingThe beginning of the parent action.
qtAtEndThe end of the parent action.

Remarks

Using this method, you can add the existing action only to the beginning (first step) or end (last step) of the parent action script.

Tip: To add the action to another location in the parent script, add the action to the beginning of the script, then retrieve the parent action script using the GetScript method, modify the script content to place the action call in the required location, and then use the SetScript method to update it.

Example

Call an existing action from the current action

'This example starts OpenText Functional Testing, opens an action, and calls an existing action from the currently open action.

' Create the application object
Dim qtApp
Set qtApp = CreateObject("QuickTest.Application") 
'Start OpenText Functional Testing
qtApp.Launch
qtApp.Visible = True
'Open test1
test1 = "C:\Users\appsadmin\Documents\UFT One\GUITest1"
qtApp.Open test1
actionLocation = "C:\Users\appsadmin\Documents\UFT One\GUITest1\Action1"
'Add an existing action at the beginning of the action
qtApp.Test.Actions("Action1").AddExistingAction actionLocation, 1' 1 == qtAtBegining
'Add an existing action at the end of the action
qtApp.Test.Actions("Action1").AddExistingAction actionLocation, 2 ' 2 == qtAtEnd
qtApp.Test.Run , true

See Also