Action Input And Output Parameters in UFT

Action input and output parameters are one of the key features of UFT to parametrize actions and passing the output of one action as input to another action across a test. In this post, I will be discussing how we can use action input and output parameters.

How to define action input and output parameters in UFT

To understand the concept of action input and output parameters, let us first create a new test. There will be only one action Action1. Add another action in the test using Call to New Action. Now there will be two actions in the test, Action1and Action2. If you want to know more about calling of actions please click here to refer my one of the posts on Actions.
Action-Input-Output-Properties-UFT
To define the action input and output parameters you have to go to the action properties and click on the Foot Step icon. The option for adding action input and output parameters will be displayed.
Action-Input-Output-Parameter-Uft
Click on the Add button, it will give you the option to add both input and output parameters.
Action Input And Output Parameters in uft
Click on the Add Input Parameter option to add the input parameter.UFT will display a warning message as shown below. Click on the Yes button.

UFT-warning

An input parameter with the name Param1 will be added under the input parameter section. By default, the value of the input parameter will be empty and its type will be String.
Action-input-parameter-uft
You can modify the parameter name by doing a left-click on it. It will again show a warning message as shown previously. Click on the Yes button. You can modify the type of the parameter as well. The warning message will be displayed every time you are going to update the input parameter details. Always click on the Yes button. I have added two input parameters and one output parameter shown below.
Action-input-parameter-uft2
Now write the below lines of code in Action2.

Now select the Action1 and call the Action2 using Call to Existing Action. It will insert the below code snippet in the Action1.

Now you will have to add the values for input and output parameters in the above RunAction method. The syntax is as follows.

Since we have defined only two input parameters and one output parameter. We will provide the values for input and output parameters in the called action. We have passed values 10 and 20 for input parameter1 and input parameter2 and storing the output value of the action in the variable OutPutVal.

Now run the Action1. It will call Action2 and compute the sum total of input parameter values and return the value in the output parameter. The same will be displayed in the message box.

Action-Output-Property-Value-UFT

Recommended Posts

Leave a Reply