Reading:  

Quick Test Professional - The starters Guide


AOM - The Automation Object Model and Automation Framewords

The Quick Test Professional (QTP) / Unified Functional Testing (UFT) Automation Object Model (AOM) is an application programming interface (API) which is used to write programs that automate QTP operations. The AOM provides functions, objects and properties that enable to control QTP from another application. The Key actions that can be controlled are:

  1. Makes QTP visible while execution
  2. Helps to Opens the Test using the specified location
  3. To loads all the required add-ins for a test
  4. Specifies the Common Object Sync Time out
  5. To Start and End Iteration
  6. Associates Function Libraries
  7. Helps to Enable/Disable Smart Identification
  8. Path of Data Table
  9. For Recovery Scenario Settings
  10. On Error Settings
  11. Settings of Log Tracking

 

To generate an automation script for QTP options:

Go to Tools select Options, Select the General tab, Click “Generate Script”, Save the script to the desired location, Click OK.


Generate Script Example QTP

Example: 

 

Generate Script Example Code QTP

 

Frameworks

 

A software framework is a conceptual platform where code with generic functionality can be overridden by developers. Frameworks take the form of libraries, where a well-defined application program interface (API) is reusable within the software under development.

Automation frameworks Types are:

  • Keyword-Driven Framework
  • Data-Driven Framework
  • Hybrid Framework

Keyword-Driven Framework:

The Keyword-Driven framework requires the data tables and keywords, independent of the test automation tool used to execute them.

Example: For GUI Component Textbox, Keywords (Action) would be Click, InputText, VerifyValue etc.

 

 

Advantages:

  • Enables writing tests in an abstract method using this approach.
  • Provides code re-usability
  • Test Tool Independent
  • Independent of Application Under Test, same script works for AUT (with some limitations)

Disadvantages

  • Initial investment being high, the benefits of this can be realized if the application is considerably big and the test scripts are to be maintained for quite a few years.
  • Act as a restriction to the technically abled testers.
  • High Automation expertise is required to create the Keyword Driven Framework.

Data-Driven Framework:

In this Framework, while Test case logic resides in Test Scripts, the Test Data is in the form of data-tables separately and kept outside the Test Scripts. Test Data is read from the external files such as Excel Files, Text Files, CSV Files, ODBC Sources, DAO Objects, ADO Objects are loaded into the variables inside the Test Script. Variables are used both for Input values and for Verification values.

Types of file supported by Data Driven Framework are:

  • Excel files
  • Data pools
  • CSV files
  • ADO objects
  • ODBC sources

 

data driver framework QTP

 

Advantages:

  • Whatever Changes done to the Test Scripts do not affect the Test Data
  • Many of Test Scenarios can be executed by varying the External Data File Test Data.
  • Test Cases can be executed with multiple Sets of Data

Disadvantages:

  • Time consumption is more to plan and prepare both Test Scripts and Test Data.

Hybrid Framework:

This is the combination of more than one framework, putting their strengths and weaknesses together.

Few important points about frameworks:

The affects factors are:

  • Framework is a solution that worked best in a certain situation but should not be construed as a set of rules to be definitely followed. It should be seen more like guidelines.
  • There might be many other frameworks in use, we have only listed and explained the common ones
  • Nomenclature: People can address their frameworks with different names. So if the names are different from one application to another.
  • Most of the frameworks can be used in conjunction with one another when any one of them cannot provide an all-round solution to your testing goals.
  • Should Support Versioning Controlling Software such as SVN,CVS, MS Source Control
  • Upon Object Changes, Scripts should execute with minimal changes.
  • Framework should have greater flexibility so that it should be easy to use
  • Framework should follow coding standards so that files, functions and history of changes are maintained correctly.

 

Designing a Framework:

To create a Data Driven Framework in QTP, the following components are needed.

  • Test Script & Object Repository: which is used to fetch the data from external source like sheet and use it on application.
  • External Data Source: which contain all the data for testing to run test script

QTP supports Data Sources are:

  • Text files
  • Microsoft Excel
  • XML files and
  • Databases like Oracle, SQL etc

Data Table:

Enter user credentials in to data table and save the test case as shown in below figure.

data table qtp

 

To execute the test cases as the number of rows in the Data Table we need to do setting, go to File select Settings click Run and select the "Run on all rows" Radio button.

The script looks like this and which perform the actions opening Flight Reservation Login page and inputting user-id and password and display the appropriate error/successful message.

 

The Output:

 

Test result demo framework QTP

 

This concludes our coverage of QTP, We hope that you've learnt a fair bit reading this tutorial. If you see any errors in any of the documents or any information provided is mileading, please contact us with your correction, thanks for reading.

 

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!