Blog to understand automation concepts in QTP, Selenium Webdriver and Manual Testing concepts

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.

How and What to parameterized using Parameterization in QTP

Test can be enhanced by parameterizing the values that it uses. A parameter is a variable that is assigned a value from an external data source or generator.Following values can be parameterized:


  •        Checkpoints
  •        Object properties for a selected step
  •        Operation arguments defined for a selected step.
  •        One or more properties of an object stored in the local object repository. 

Values can be parameterized using:

  •       Test/action parameters
  •       DataTable parameters
  •       Environment Variable parameters
  •       Using Random number parameters

Parameter Types: 

Following are the parameter types used for parameterization


·        Test/action parameters:

 Test parameters enable to use values passed from the test. Action parameters enable to pass values from other actions in the test. 

·         Data Table parameters: 

Enables to create a data-driven test (or action) that runs several times using the data supplied. In each repetition, or iteration, QTP uses a different value from the data table

·        Environment variable parameters:


 Enables to use variable values from other sources during the run session. These may be values supplied, or values that QTP generates based on conditions and options

·        Random number parameters. 

Enables to insert random numbers as values in the test


Synchronization in QTP


      A synchronization point instructs QTP to wait until certain response from the application during playback.Synchronization point is required due to reason that when a test is run, the application may not always respond with the same speed. For example, it might take some extra time for below activities


  • for a progress bar to reach 100%
  • for a status message to appear
  • for a button to become enabled
  • for a window or pop-up message to open

      Synchronization can be used to ensure that QTP waits until the application is ready  before performing a certain step in following ways:


  • Timeout Value Modification
  • Using WaitProperty
  • Using Wait  Statement
  • Using Exist Statement

Timeout Value modification


Object Synchronization timeout  Sets the maximum time (in seconds) that QTP waits for an  
object to load before running a step in the test.

To define the Object  Synchronization timeout, Access  File > Settings > Run.



Using WaitProperty


Adding a synchronization point instructs QTP to pause the test until an object property  achieves the value specified.

The below dialog box enables to insert a WaitProperty statement to synchronize test.


How to Access:


  • Start a recording session.
  • Display the screen or page in application that contains the object for which a synchronization point needs to be inserted.
  • In the QTP window, select Insert >Synchronization Point.

WaitProperty is displayed in Expert View as shown below
Browser(".").Page("…").WebElement("…").WaitProperty "visible", true, 10000


Using Wait and Exist Statement


Exist and/or Wait statements can be used to instruct QTP to wait for a window to open or an object to appear

Exist Statement:


Exist statements return a Boolean value indicating whether or not an object currently exists

Eg:  blnExist = Browser(“…”).Page(“…”).Object.exist

Wait Statement:


Wait statements instruct Quick Test to wait a specified amount of time before proceeding to the next step.

Eg:  Wait(30)

Below code shows an example of Using Wait and Exist Statement for synchronization.

blnDone=Window("Flight Reservation").Dialog("Flights Table").Exist
counter=1
While Not blnDone
Wait (2)
blnDone=Window("Flight Reservation").Dialog("Flights Table").Exist
counter=counter+1
If counter=10 then
blnDone=True
End if
Wend