Reading:  

Quick Test Professional - The starters Guide


Working with Actions

Actions which mainly help to divide scripts into groups of QTP statements called actions.

There are 3 types of QTP actions:

  • Reusable: These type of actions can be called multiple times within the same or different tests
  • Non-reusable: These type of actions cannot be called by any other actions
  • External actions: A reusable action when called from another action becomes an external action in the called action.

Actions are similar to functions in VBScript, but few differences between them are listed below.

Actions:

Functions:

Action is a collection of Vb statements in QTP. It does not return any values.

Function collection of Vb statements in QTP. It returns single value.

Every Action will have its own data table.

Function does not have own data table

Actions may or may not be reusable.

Functions are always reusable.

Actions are saved with extension .mts

Functions are saved with extension .vbs or .qfl

Parameters should be passed by value only.

Parameters are passed either by by value or by reference.

Actions are in-built feature of QTP.

Functions are supported by both VBScript and QTP.

Action can contains Object Repository, Data table, Active screen etc.

Function does not have these features.

 

The Action properties can be accessed by Right Clicking on the Script Editor Window and Selecting "Properties" as shown below:

Action properties contains following information

  • Action Name
  • Location
  • Reusable Flag
  • Input Parameters
  • Output Parameters

Action Properties QTP

Working with Actions:

Calling an Action:

Action can be called in following ways: 

1. Inserting call to New Action: User can insert a new action at any point of the script.

2. Inserting 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. Inserting call to Existing Action: External actions can be called from the action by call to external action.

Inserting call to New Action:

New action can be added at any point of the script by user.

Step 1: Right Click on the Scripting area and click on “Call to New Action" as shown below

Call to New Action QTP

 

Step 2: The "Insert Call to New Action" Window opens, give the test name, description, and also specify if it is a reusable action or not and importantly select the location the action to be inserted then click OK.

 

 

Step3: User can check the changes graphically in the test Name Tab as shown below:

We can also use QTP commands to call the Action at any point in the script.

 

 

Action can be called with Parameters as shown below:

 

 

Inserting Call to Copy of Action:

A copy of an existing action can be added at any point of the script by user.

Step 1: Right Click on the Scripting area and click on "Call to Copy of Action"

 

Step 2: Select the "Test Name", "Action Name" and the location the action to be inserted as shown below.

Step 3: An auto generated script will show that the copy of an action is inserted as shown below:

 

 

Step 4: User can check the changes graphically in the test Name Tab as shown below:

 

Inserting call to Existing Action:

Testers can insert an Existing action at any point of the script by user.

Step 1: Right Click on the Scripting area and select "Call to Existing Action"

Call to Existing Action QTP

Step 2: Once the "Select Action" Window opens, give the test name, Action name, description and also specify the location of the action to be inserted.

 

Step 3: The below script is generated in the location where the action was inserted.

 

 

Step 4: User can check the changes graphically in the test Name Tab as shown below:

 

 

 

 

Description

In this tutorial, we will get to know Quick test professional. At the time of writting QTP is at version 12.2. This tutorial is subdivided into multiple parts as shown below

  • What is QTP
  • Automating tests
  • Environment
  • Recording and Playback
  • Object Repository
  • Actions
  • Data Table
  • Checkpoints in QTP
  • Synchronization
  • Smart Identification
  • Debugging and Error handling
  • Recovery Scenarios
  • Environment Variables
  • Library Files
  • Test Results
  • GUI Objects
  • Virtual Objects
  • Accessing Databases
  • Working with XML
  • Descriptive Programming
  • Automation Object Model
  • A work on Frameworks

Leave your feedback for us, Feedback help us improve our tutorials.

 



Prerequisites

Some knowledge on Windows OS and VB Script is recommended

Audience

Students who wish to learn QTP

Learning Objectives

Learn QTP

Author: Subject Coach
Added on: 16th Mar 2015

You must be logged in as Student to ask a Question.

None just yet!