Wednesday, May 6, 2009

How to pass parameters(input & output) between actions?

Here i want to pass two values from Action1 to Action2. In Action2 i am defining input parameters and output parameters. I do some operation and return the value as output parameter.

1. Start a new test
2. Create a new action by choosing Insert Menu -> Call to New Action
3. Choose "Reusable action" checkbox for Action2 and click Ok.
4. Now you are in Action2, now choose Edit Menu -> Action -> Action Properties and click on parameter tab.
Add two inpur parameters. To do this click on "+" sign.
Give the first parameter name as "a" and type as number.
Add another parameter with name as "b" and type as number.
In the output parameter add a parameter name with "result" of type number and click on ok button.
If any warning message displayed click on Yes button.
5. Do whatever operation you want in Action2. Here i want to add these values and assign to output parameter value soI am adding one statement called
parameter("result")=Parameter("a")+Parameter("b")
6. Now in the Keyword view, if Action2 is displayed, then right click on that action and choose delete. Choose "Delete the selected call to the action" and click ok button.
7. Now swith to Expert view and choose Action1.
8. Include the following two statements in Action1.
RunAction "Action2",0,34,54,var '(Here 34 and 54 vare const values i am supplying as input parameters to action2 and the result i am saving in 'var' variable).
msgbox var