QTP10.com is a new and completely free website that offers help in all the versions of HP QTP (including latest version 10). More importantly, it offers free code for users of HP QuickTest Professioal. This site helps you in learning the basics of QTP and descriptive/advanced programming in (QTP) on various environments like - .Net, Infragistics, Web, Windows, etc.

Note -
This blog is NOT affiliated with HP / Hewlett-Packard in any way. The data/questions come from various sources and we have our own testing questions. I am just another Software Tester like you.

Specify Action's Input Parameters in QTP

Share This Post -

Sponsored Links:

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 parent action that calls it (for a nested action), or from the output of a previous action call (for a sibling action).

You can specify output parameters for an action, so that it can return values for use later in the test. For example, you can output a parameter value to a parent action so that a later nested action can use the value.

 

For each input or output action parameter, you define a name (case sensitive), a type, and optionally, a description. You can also specify a default value for each action input parameter, or you can use the default value that QTP 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 (Edit > Action > Action Properties or right-click an action and select Action Properties).

 

Action Parameters

 

To add a new input or output action parameter:

  1. Click the Add button above 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.
  2. Click in the Name box and enter a name for the parameter. (Action parameter names are case sensitive.)
  3. 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, QTP 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 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. In the action, however, the value appears encrypted. The default value is an empty string, which also appears as an encrypted value in the actual action.
    • 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, QTP checks whether it is a number. If the value is not a number, QTP automatically encloses it in quotation marks. If you are editing an existing value, QTP automatically encloses it in quotation marks if the previous value had quotation marks. The default value is an empty string.

  4. If you are defining an input action parameter, click in the Default Value box and enter a default value for the parameter. Alternatively, you can leave the default value provided by QTP 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.
  5. (Optional) Click in the Description box and enter a description of the parameter, for example, the purpose of the parameter in the action. QTP displays this description together with the name of the parameter in any dialog box in which you can choose an action parameter, including the Output Options, Parameter Options, and Value Configuration Options dialog boxes.
  6. To modify an existing action parameter:
  7. Select the parameter you want to modify from the Input parameters or Output parameters list.
  8. Modify the values as necessary in the edit boxes of the parameter row.
  9. To delete an existing action parameter:
  10. Select the parameter you want to delete from the Input parameters or Output parameters list.
  11. Click the Delete button. The parameter is removed from the list.
  12. Note: When you delete an action parameter, make sure that you also delete any steps that use the action parameter.

     

    Go Back to: QTP Tutorial 8 - Working with Advanced Action Features in QTP