Actions in
QTP - Types of Action and Calling Actions
Actions help divide your test into logical units, A test
comprises calls to actions.
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-only
2. 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:
1. There can be maximum
of 120 actions in a test.
2. For each action in a
test, a new sheet in data table exists.
3. Data defined in
global datasheet can be used by all the actions in the test.
4.Data defined in per
action datasheet can be used by specified function only.
5. If we want to edit
resources associated with a called action, use call to copy of action.
6. We can use input and
output Parameter for an action, to get parameter value from an action.
7. Extension for actions
is .mts
8. We can have multiple
outputs from an action.
A] Inserting call to New Action
New action can be inserted at any point of time during testing by following given below steps,
Create a new action by giving safe place to buy modafinil online name Flight Finder. Right-click anywhere in the canvas to choose “Call to New Action”.
The “Insert Call to New Action” dialog box opens, enter the Name: Flight Finder, and ensures that “Reusable Action” and “At the end of the test”both options are selected then click “OK”.
Once the dialog box gets closed, the Flight Finder action will add to the end of a test.User can see the modifications graphically in the test Name Tab as shown below:
Similarly, user can create other actions as like Flight Finder action creation process. Create action for “Select Flight” and “Book Flight”.
B] Inserting Call to Copy of Action:
Copy of an existing action can be inserted at any point of time during testing by following given below steps,
Create a copy of an existing action “Flight Finder”, right-click anywhere in the canvas to choose “Call to Copy of Action”.
The dialog box opens to create copy of action, Select the “Test Name”, “Action Name” and also select the location the action to be inserted.
Once the dialog box gets closed, the copy of Flight Finder action will add to the end of a test. User can see the modification graphically in the test Name Tab as shown below:
C] Insert Call to Existing Action:
Existing action can be inserted at any point of time during testing by following given below steps,
In the canvas, right-click anywhere and choose “Call to existing Action”.
In the “Select Action” Window, give the test name, Action name, description and also specify the location of the action to be inserted.
User can see the modifications graphically in the test Name Tab as shown below,
Save the created test by clicking on “Save”.