Actions help divide your test into
logical units, A test comprises calls to actions.
LoadAndRunAction "Complete path of the test", "Name of Action"
Once a test is created, an action is
created for the test. The Action is reusable by default. A reusable action can
be called from various actions within the test or from external tests.
Creating multiple actions in test
help to enhance reusability and modularize the tests.
Types of Action:
Following are the types of Actions
in QTP:
1. Reusable Actions
Can be called from multiple actions within or outside the test. An Action is reusable by default.2. Non-reusable Actions
Cannot be called from other actions. Uncheck reusable checkbox while creating an action.3. External Actions
This is a
reusable action stored in another test.
4. Nested Action
An action called from other actions is nested action for the action from which it is called.Calling An Action:
Action can be called in following
ways:
1. Call to Existing Action
We can view the steps of the action in the action view, but cannot modify them. The called action’s local object repository is also read-only2. Call to Copy of Action
We can view the steps of the action in the action view and also modify the associated resources with the action. This action is non-reusable in the test.3. Call to External Action
External actions can be called from the action by call to external action.
External Action can be called in
expert view using LoadandRunAction as shown below:
LoadAndRunAction "Complete path of the test", "Name of Action"
Points to Remember about Actions
Some Important points to remember
for Actions are as follows: