QTP - Actions
Actions helps testers to divide scripts into groups of QTP statements. Actions are similar to functions in VBScript; however, there are a few differences. By default, QTP creates a test with one action.
|Action is an in-built feature of QTP.||VBScript Functions are supported by both VBScript and QTP.|
|Actions parameters are passed by value only.||Function parameters are passed either by by value or by ref.|
|Actions have extension .mts||Functions are saved as .vbs or .qfl|
|Actions may or may not be reusable.||Functions are always reusable.|
The properties of the action can be accessed by right clicking on the Script Editor Window and selecting "Properties".
Action properties contains the following information −
- Action Name
- Reusable Flag
- Input Parameters
- Output Parameters
Types of Actions
There are three types of actions −
Non-reusable action − An action that can be called only in that specific test in which it has been designed and can be called only once.
Reusable action − An action that can be called multiple times, any test in which it resides, and can also be used by any other tests.
External Reusable action − It is a reusable action stored in another test. External actions are read-only in the calling test, but it can be used locally with the editable copy of the Data Table information for the external action.
Working with Actions
There are three options to insert an action. Click on each one of those to know more about the selected type of action.
|S.No||Action Type & Description|
|1||Insert Call to New Action
Inserts a New Action from the existing action
|2||Insert Call to Copy of Action
Inserts a copy of an existing action
|3||Insert Call to Existing Action
Inserts a call to existing re-usable action