UFT action is a component in which you can write your code, i.e. code for a specific functionality. Scenario: Say you want to send a mail from Gmail & then logout. What would the steps be for this Test script?
- Login to Gmail
- Compose an Email
- Send Email
Keeping actions in mind, now our UFT Test script for above scenario will be like,
- Call Action1: Login to Gmail
- Call Action2: Compose an Email
- Call Action3: Send Email
- Call Action4: Logout
As you may notice – Action help to divide the Test script into logical units or business flows. In fact, a UFT Test script is itself a collection of one or more actions. Each Test case in UFT consists of one or more actions and the flow of the Test case is determined by the order of action calls.
Different Types of UFT Actions
Based on re-usability
- Reusable Action – can be called from any Tests (by setting the Reusable Flag in Action properties)
- Non-reusable Action – can be called only once and that too in the Test where they are stored.
Based on where the actions are stored
- External Action – stored in some other Test case. External actions should be reusable otherwise it can’t be used outside the Test case.
- Internal Action – stored within the same Test case. This action can be reusable as well as non-reusable.
By default when a script is created it consists of only one action. But you can add more Actions to your UFT Script as per requirements.
The entire purpose of creating Action(s) is to use them in other Test Scripts.
Call to 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. As it is copied, it is editable in the calling test.
Call to an EXISTING Action
Calls to reusable action from another action. Since it is just a call – original action is read-only in the calling test. They can only be modified in the test in which they were created.
- Readability: A Test script can be read Action by Action in the order of calling
- Re-usability: Actions can be used within multiple scripts to verify the same functionality (like Login)
- Modular: By creating tests that call multiple actions, you can design tests that are more modular and efficient.
- Efficient: HP UFT Actions enable you to parametrize and iterate over specific elements of a test.
- Maintainability: Make it easier to modify steps in one action when part of your application changes.
- Debugging is very easy i.e., finding logical errors in the script
To summarize – A Test comprises calls to actions. When you create a new test, it contains a call to a single action. For every action called in your test, QTP creates a corresponding action sheet in the Data Table so that you can enter Data Table parameters that are specific to that action only.
What are you waiting for? ‘Act now’ via Actions!