Parameterization using Action parameter in QTP

Parameterization is the process of replacing the constant/static values to a reusable parameter.

Parameterization using Action parameter in QTP (without using Data Table)

  1. Open QTP with a new blank test, in a new qtp test, select “Keyword view” Tab
  2. In the Keyword View right click on Action1 and select “Action Properties”, after clicking “Action properties” window opens.
  1. Go to “Parameters” tab, Click on “+” sign which is on the top right to add the parameters to the current action.
  2. Enter the name of the parameter as “value1” and select type as Number, In the same way create another parameter with type as number called “value2”Action parameter in QTP-Action Properties
  3. Click ok button in Action Parameters tab
  4. In the keyword view right click on Action1 and select “Action Properties”, after clicking that “Action Properties” window opens, In the general tab, click on “Reusable Action’ checkbox at the bottom to make the action reusable.

Action parameter in QTP-Action Properties Reusable action

  1. In the Expert View of Action1 types , Type the following code

 S1=parameter (“value1)

S2=parameter (“value2”)

  1. Go to Insert (menu) ->Click on Call to new Action link, after clicking the link “Insert call to New Action” window opens; click ok button to insert a new action.
  2. Make action2 reusable as did for action1
  3. In the Expert view of action2 type the following

RunAction “Action1”,oneIteration, 4,4                            ‘4,4 are input values, can be changed at run time’

  1. In the keyword view right click on Action2 and select “Run from Step”, It will show the sum of the parameters in msgbox (in the above case result is 8)Action parameter in QTP -Action 2

How to change Parameter Name after Parameterization

Select the Appropriate action which the parameter to be renamed, Then Go to Keyword view, select the existing parameter, under value column Rename the value and open value configuration options then select parameter radio button and select the parameter and click ok button, Script’s will automatically replace the existing parameters to the modified one.

The value of the input can be changed before running the tests, and also can add multiple parameters.

Leave a Reply

Your email address will not be published. Required fields are marked *