Action parameters enable you to transfer input values from your test to a top-level action, from a parent action to a nested action, or from an action to a sibling action that occurs later in the QuickTest Profession test. Action parameters also enable you to transfer output values from a step in an action to its parent action, or from a top-level action back to the script or application 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 can use action parameters in any step in your action (including function calls). 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 (Edit > Action > Action Properties or right-click an action and select Action Properties). You specify the actual values that are provided to these parameters and the locations in which the output values are stored using the Parameter Values tab in the Action Call Properties dialog box (opened by right-clicking an action and choosing Action Call Properties).
You can specify input parameters for an action so it can receive input values from elsewhere in the test. Input values for an action parameter can be retrieved from the test (for a top-level action), 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 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 QTP test script.
For example, suppose you want to take a value from the external application that runs (calls) your test and use it in an action within your test. In the test below, you would need to pass the input test parameter from the external application through Action2 and Action3 to the required step in Action4.
You would do this as follows:
- Define the input test parameter (File > Settings > Parameters node) with the value that you want to use later in the test.
- Define an input action parameter for Action2 (Edit > Action > Action Properties > Parameters tab) with the same value type as the input test parameter.
- Parameterize the input action parameter value (Edit > Action > Action Call Properties > Parameter Values tab) using the input test parameter value you specified above.
- Define an input action parameter for Action3 (Edit > Action > Action Properties > Parameters tab) with the same value type as the input test parameter.
- Parameterize the input action parameter value.
- Define an input action parameter for Action4 (Edit > Action > Action Properties > Parameters tab) with the same value type as the input test parameter.
- Parameterize the input action parameter value.
- Parameterize the value in the required step in Action4.
- Click the parameterization icon and specify the parameter in the Value Configuration Options dialog box using the input action parameter you specified for Action 4.
- Use the Parameter utility object in the Expert View to specify the value to use for the step.
- An action's parameters are stored with the action and are the same for all calls to that action. If you modify an action parameter's name, type, or description, and then view the action properties for a call to that same action in a different part of the test, you will see that the action parameter has changed.
The actual value specified for an input action parameter and the location specified for action output parameter can be different for each call to the action. When you insert a call to a copy of an action, the copy of the action is inserted with the action parameters and action call parameter values that were defined for the action you copied. When you split an action, the action parameters are copied to both actions. The action call values for the second action are taken from the default values of that action's parameters.
Post a Comment