Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - How to pass parameters into an action? Explain with examples




264
views
asked marvit August 28, 2014 02:20 AM  

How to pass parameters into an action? Explain with examples


           

1 Answers



 
answered By Dharma   0  
This short tutorial guides you to the process of passing parameters between Actions in QTP.

Step-1: Create a test with the structure: Action1 on the top-level, Action2 embedded in Action1.

1) Open a new test.
2) Go to Insert -> Call to New Action.
3) Select the "After the current step" radio button.
4) Click . The new action should be inserted into Action1.

Example:
Action1
Action2


Step-2: Define an input test parameter:

1) Go to Test -> Settings.
2) Select the Parameters tab.
3) Click the add button (+) for the Input parameters.
4) Enter the following values:
5) Name: TestParam
6) Type: String
7) Value: Hello
8) Click and .


Step-3: Define

an input parameter for Action1:

1) Right-clicking on Action1 and select Action Properties.
2) Select the Parameters tab.
3) Click the add button (+) for the Input parameters.
4) Enter the following values:
5) Name: Action1Param
6) Type: String
7) Click .


Step-4: Parameterize the input action parameter in Action1: So that it pulls the value from the parameter defined in the test settings.

1) Right-click on Action1 and select Action Call Properties.
2) Select the Parameter Values tab.
3) Click on the cell under the Value column for Action1Param. You will see a button on the right of the cell, click it.
4) Select the "Parameter" radio button. "Test Parameter" should be selected by default.
5) In the Name drop-down list, select "TestParam", which matches the input parameter created in the test settings.


Step-5: Repeat steps 3 and 4 for Action2:
1) Except name the input parameter Action2Param, and when parameterizing the input value, select Action1Param from the Name drop-down list.


Step-6: In Action2 insert the following line using Expert View:

msgbox Parameter("Action2Param")

The above steps can be repeated if you wish to pass more Parameters.
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert