Wednesday, May 4, 2011

Test Parameters and Action Parameters

There are two types of parameters
1. Test Parameters.
2. Action Parameters.

Define Parameters:

If you consider actions are as pages of a book, then test is nothing but a cover pages of it. So Test Parameters are the Parameters which applies to all the action of the test. You can use the Test Parameters in any actions but before using them user has to call then in the actions. For example if a TEST has 3 actions (Action1,Action2 and Action3), if you want use Test Parameters in Action1, then you have to call them in Action1.

How to Define Test Parameters: Go to Test Settings File-->Settings--> Test Settings window will open.
Click on Parameters. Click on '+' mark, Enter the name of the Paremeter,Type, default value and description in 'Input Parameters' section.
Example:
Name: UserName_IN
Type: String
Default Value: test1
Description: Enter the User Name.
Click on Apply and OK button.
How to Use: To use Test Parameters in Actions, Action parameters must have defined. Click on 'Keyword View', right click on 'Action1' click on 'Action Properties'. On Action Properties window click on 'Parameters' tab. Define Input and output parameters (same as test parameters, name must be different).
Example:
Name: UName_IN
Type: String
Default Value: 
Description: Enter the User Name.
Click on OK button.
Again click on 'Keyword View', select 'Test Flow' from drop down present at the left top of the test. Right click on Action1, click on 'Action Call Properties', on Window click on 'Parameter Values' tab. The Action parameters will be displayed. Click under 'Value' column. Click on <#> icon. 'Value configuration Options' window will open. Click on Parameter radio button, select test parameters from drop down. Click OK, and OK. Click on Expert View and call the parameter.
msgbox Parameter("UName_IN")
Result: test1.
Note: You can change the parameter values in run time.
Click on RUN, on RUN window click on 'Input Parameters', Change the value and click OK.

You can use the TEST Parameter only in Action1, if you want to use TEST parameters in Action2 and Action3, it is necessary to define action parameters.

If you want to use only Action Parameters then not necessary to select Parameter radio button on 'Value configuration Options' window.