QTP Framework Tutorials – Framework Types, Examples & Sample Code

QTP Framework Tutorials
Everything you wanted to know about automation frameworks with QTP

QTP Framework, or in general, a test automation framework, is a ‘set of guidelines’ which you can follow during scripting to achieve some ‘desired’ results. These desired results can anything like – the code should be easy to understand and maintain, it should be re-usable and easily scalable”

Some useful guidelines to create automation frameworks

Listed below are few common guidelines that will help you get started with creating your own automation frameworks in QTP. All these guidelines have been covered in detail in the individual articles on QTP frameworks.

QTP Framework Guidelines
a) coding standards, comments structure and variable naming conventions
b) structure of excel data sheets, grouping of workbooks and individual sheets
c) folder structure for test scripts, reusable libraries and object repositories
d) storing test run results, overwriting results or saving the results separately
e) accessing and updating repositories, libraries by different team members
f) and many more such features depending upon individual requirements

Salient features of a good automation framework

a) The framework should be such that it helps to achieve maximum possible re-use.

b) The framework code should be easy to read, understand and maintain.

c) All components in the framework such as test cases, function libraries, object repositories, data sheets, test results etc should be stored in separate folders.

d) Test data should be kept separate from code, preferably in excel sheets.

e) Error handling and batch execution should be added to the framework.

f) Auto-email (or sms) sending feature can also be implemented in the framework.
QTP Framework Guidelines

Different types of QTP frameworks

QTP Framework Types

Introduction to QTP Frameworks (eBook)

This eBook will provide you with a quick introduction about each of the automation frameworks. This will include the features of the framework, its flow, and its advantages and disadvantages

eBook (PDF) – Basics of QTP Framework

QTP Linear Framework

This is the most basic framework where you write your script as is. That is, with this approach you write all the steps one after the other in a linear fashion.

QTP Linear Framework – Complete Guide with AOM example [sample code available]

QTP Modular Framework

With this framework, you write the entire code into different functions and then you call these functions wherever required. These functions can be both reusable and non-reusable.

Designing QTP modular framework from scratch [sample code available]

QTP Data Driven Framework

In this type of QTP framework, your data is kept separate from the code, preferably in excel files. This helps you execute the same code for multiple sets of data.

Basics of Data Driven Framework in QTP – Part 1 [sample code available]
How to Select appropriate Data Sheet format for Data Driven Framework
Designing Data Driven Framework that uses Excel Sheets – Part 2 [sample code available]
Designing Data Driven Framework that uses Excel Sheets – Part 3 [sample code available]

QTP Keyword Driven Framework

In this type of QTP Framework, you can create different keywords and associate different actions with these keywords. When QTP encounters a particular framework, it will execute the action associated with that framework.

Basics of Keyword Driven Framework in QTP
Keyword Driven Framework mapped at Operation Level – Part 1
Keyword Driven Framework mapped at Operation Level – Part 2 [sample code available]
Keyword Driven Framework mapped at Functional Level – Part 1
Keyword Driven Framework mapped at Functional Level – Part 2 [sample code available]

QTP Hybrid Framework

Hybrid framework is a combination of one or more frameworks discussed above. Based upon your requirements, you can combine the features of any of the above frameworks. The resultant framework would be a Hybrid framework.

Architecture and features of a Hybrid Framework
Designing a Hybrid Framework in QTP – Part 1
Designing Hybrid Framework in QTP – Part 2
Designing Hybrid Framework in QTP – Part 3

Business Process Testing (BPT) Framework

In this QTP Framework, you can divide your test case flow into multiple Business Components. You can then re-use these components as many times as required. You need Quality Center access in order to use BPT Framework. Also you need to acquire BPT license from HP in order to use this framework.