How to use Actions in QTP
This tutorial demonstrates Actions. It uses the vanilla Test Script created in previous tutorials with 5 steps to log in into Flight Reservation.This tutorial is the longest in all QTP tutorials and its recommended you take notes while viewing it.
- Actions help divide your test into logical units or Business Processes
- Actions help create a script which is more modular and efficient.
- When a script is newly created it consists of only one action .A script can consist of one or more Actions .
- There two types of Actions 1)Reusable Actions & 2) Non-Reusable Actions
- Reusable Action can be used in other Tests. They can be used in the same Test Script multiple times.
- Non reusable Action can not be used in other Tests. They can be called in the same script only once
- You can split an existing action in two ways 1) Independent of each other which splits the selected action into two sibling actions 2) Nested Action which splits the selected action into a parent action whose last step calls the second, child action
- QTP provides 2 type of datasheets 1) Global & 2) Local
- GLOBAL Datasheet : It is Unique for the entire test. Any Action can access and write data into Global Datasheet. Sheet is named "GLOBAL"
- LOCAL Datasheet : Equal to number of Actions in the sheet. An Action can read and write data into its own local Datasheet only. Sheet name = "ACTION NAME"
- There are two methods to import Actions into a Test 1) Call to Copy & 2) Call to Existing.
- Call to COPY of an Action : When you make a Copy of an Action , the action is copied in its entirety, including checkpoints, parameterization, and the corresponding action tab in the Data Table into the calling test . When you insert a copy of an existing action, you can make changes to the copied action, and your changes will not affect nor be affected by any other test. You can insert copies of both reusable and non-reusable actions
- Call to an EXISTING Action : Calls to actions are read-only in the calling test. They can only be modified in the test in which they were created. Enables you to use the same action in several tests and makes it easy to maintain tests. You can make calls to only "Reusable" actions.
- You can change the action iteration frequency by selecting Action Call Properties > Run Tab