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".
Step 2 − In the "Insert Call to New Action" Window, give the test name, description, and also specify if it is a reusable action or not. Most importantly, select the location of the action to be inserted.
Step 3 − You can check the changes, graphically, in the test Name Tab as shown below −
You 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