Monday, March 10, 2008

QTP Action input output parameters Example 4

Action output value (value returned by a called action) can be stored in Any variable and RunAction Statement is not used.

Open a new test. By default it will have Action1.

Go to Insert-> Call to New Action, to add a new action at the end of the test.

Now we have Action1 and Action2 in this test.

In the Keyword View, right click on Action1 and choose Action Properties.

Go to Parameters tab and create output variable out_a1_1 with Type as Any.

In the Keyword View, right click on Action2 and choose Action Properties.

Go to Parameters tab and create input variable in_a2_1 with Type as Any.

In the Keyword View, right click on Action1 and choose Action Call Properties.

Go to Parameters tab and in the ‘Store In’ column enter var1.

In the Keyword View, right click on Action2 and choose Action Call Properties.

Go to Parameters tab and in the Value column enter var1.


In the expert view of Action1 type:

Parameter("out_a1_1") = 23

In the expert view of Action2 type:

msgbox Parameter(" in_a2_1")