Variables
- 11:15 AM - 0 comments
Action Parameters in qtp scripting
In QTP scripting there are mainly 3 types of variable that we use. They are:
- Action Parameters.
- Environment Variables.
- VB Variables, which we declare in the script.
Action Parameters
Action parameters enable you to transfer values between actions and their nested actions in your test, from your test to a top-level action, or from a step in a top-level action back to the script or action that ran (called) your test. For example, you can output a value from a step in a nested action and store it in an output action parameter, and then use that value as input in a later step in the calling parent action.
You define the parameters that an action can receive and the output values that it can return in the Parameters tab of the Action Properties dialog box. You specify the actual values that are provided to these parameters and the locations in which the output values are stored in the Parameter Values tab in the Action Call Properties dialog box.
You can specify input parameters for an action so it can receive input values from elsewhere in the test. Input values for an action can be retrieved from the test (for a top-level action) or from the parameters of the action that calls it (for a nested action). You can also specify output parameters for an action, so that it can output values for use later in the test, or pass values back to the application that ran (called) the test.
Setting Action Parameters
You can specify input parameters for an action so that steps in the action can use values supplied from elsewhere in the test. Input values for an action parameter can be retrieved from the test (for a top-level action) or from the parameters of the action that calls it (for a nested action). You can specify output parameters for an action, so that it can return values for use later in the test. For each input or output action parameter, you define a name and a type. You can also specify a default value for each action input parameter, or you can use the default value that QuickTest provides for the parameter value type that you choose. The default value is saved with the action and is used by the action if a value is not defined for a parameter in the action call. You can define, modify, and delete input and output parameters in the Parameters tab of the Action Properties dialog box.

To add a new input or output action parameter:
Action parameters enable you to transfer values between actions and their nested actions in your test, from your test to a top-level action, or from a step in a top-level action back to the script or action that ran (called) your test. For example, you can output a value from a step in a nested action and store it in an output action parameter, and then use that value as input in a later step in the calling parent action.
You define the parameters that an action can receive and the output values that it can return in the Parameters tab of the Action Properties dialog box. You specify the actual values that are provided to these parameters and the locations in which the output values are stored in the Parameter Values tab in the Action Call Properties dialog box.
You can specify input parameters for an action so it can receive input values from elsewhere in the test. Input values for an action can be retrieved from the test (for a top-level action) or from the parameters of the action that calls it (for a nested action). You can also specify output parameters for an action, so that it can output values for use later in the test, or pass values back to the application that ran (called) the test.
Setting Action Parameters
You can specify input parameters for an action so that steps in the action can use values supplied from elsewhere in the test. Input values for an action parameter can be retrieved from the test (for a top-level action) or from the parameters of the action that calls it (for a nested action). You can specify output parameters for an action, so that it can return values for use later in the test. For each input or output action parameter, you define a name and a type. You can also specify a default value for each action input parameter, or you can use the default value that QuickTest provides for the parameter value type that you choose. The default value is saved with the action and is used by the action if a value is not defined for a parameter in the action call. You can define, modify, and delete input and output parameters in the Parameters tab of the Action Properties dialog box.

To add a new input or output action parameter:
- Click the Add button next to the Input parameters or Output parameters lists to add a new parameter to the appropriate list. A row for the new parameter is added to the relevant list.
- Click in the Name box and enter a name for the parameter.
- Select the value type for the parameter in the Type box. You can select one of the following types:
- String—A character string enclosed within a pair of quotation marks, for example, "New York". If you enter a value and do not include the quotation marks, QuickTest adds them automatically when the value is inserted in the script during the test run. The default value is an empty string.
- Boolean—A true or false value. If you select a Boolean value type, you can click in the Default Value column and click the arrow to select a True or False value. The default value is True.
- Date—A date string, for example, 3/2/2005. If you select a Date value type, you can click in the Default Value column and click the arrow to open a calendar from which you can select a date. The default value is today's date.
- Number—Any positive or negative number. The default value is 0.
- Password—An encrypted password value. If you select a Password value type, the password characters are masked when you enter the password in the Default Value field. The default value is an empty string.
- Any—A variant value type, which accepts any of the above value types. Note that if you select the Any value type, you must specify the value in the format that is required in the location where you intend to use the value. For example, if you intend to use the value later as a string, you must enclose it in quotation marks. When you specify a value of Any type, QuickTest checks whether it is a number. If the value is not a number, QuickTest automatically encloses it in quotation marks. If you are editing an existing value, QuickTest automatically encloses it in quotation marks if the previous value had quotation marks. The default value is an empty string.
- If you are defining an input action parameter, click in the Default Value box and enter a default value for the parameter or you can leave the default value provided by QuickTest for the parameter value type. The default value is required so that you can run the action without receiving parameter values from elsewhere in the test.
- If you wish, click in the Description box, then enter a description of the parameter, for example, the purpose of the parameter in the action.
To modify an existing action parameter:
1. Select the parameter you want to modify from the Input parameters or Output parameters list.
2. Modify the values as necessary in the edit boxes of the parameter row.
To delete an existing action parameter:
1. Select the parameter you want to delete from the Input parameters or Output parameters list.
2. Click the Delete button . The parameter is removed from the list.
1. Select the parameter you want to modify from the Input parameters or Output parameters list.
2. Modify the values as necessary in the edit boxes of the parameter row.
To delete an existing action parameter:
1. Select the parameter you want to delete from the Input parameters or Output parameters list.
2. Click the Delete button . The parameter is removed from the list.


0 Responses to "Action Parameters in qtp scripting"
Post a Comment