QTP - Call to New Action


Inserting call to New Action:

Testers can insert a new action at any point of the script by performing the following steps:

Step: 1 - Right Click on the Scripting area and select "Call to New Action"

Inserting Call to New Action Step 1

Step: 2 - In the "Insert Call to New Action" Window, give the test name, description, and also specify if it is a reusuable action or not. Most Importantly select the location the action to be inserted.

Inserting Call to New Action Step 2

Step: 3 - User Can check the changes graphically in the test Name Tab as shown below:

Inserting Call to New Action Step 3

We can also use QTP commands to call the Action at any point in the script.

RunAction "Calculate", oneIteration 	'Executes  Calculate Action for one iteration.

Action can be called with Parameters as shown below:

'Input to the action
num1 = 5
num2 = 10
Dim value1

'Run the action with parameters
OutputValue = RunAction("Calculate", oneIteration, num1, num2, value1)

'Display the output
print OutputValue