Expert Author Anish Kumar Pillai

Let us assume that you have been asked to create some test scripts in QTP. As an automation engineer, what would be the tasks you want to complete as part of this exercise? The most important task is that the test case should do the intended work. Other than that wouldn't you want that your code is easy to understand, can be re-used, needs little maintenance and can be expanded? All these are the things which if you have, makes your life much easier. And how do you achieve all these things? Well, this can be done by using a good Test Automation Framework.

What does QTP Framework Mean?

QTP Framework, or in general a Test Automation Framework, are some guidelines which you can follow during scripting to achieve the above mentioned 'desired' results. These set of guidelines can be anything such as -

- coding standards like the variables names should begin with the type of variable (eg. boolVar, flFlag), function names should start with fn (eg. fnCalculateSum).
- format of your data sheets, how your workbooks and the individual sheets in them are grouped.
- what folder structure is required to be followed to store the test scripts, reusable libraries, object repositories, test run results.
- how should run results be saved and displayed.
- how all team members should access that shared repositories, libraries and how they should update these.
- and many more..

Following these guidelines would lead to the task being done in a consistent manner which would ultimately result in a framework which will provide you with all the benefits that you have aimed for.

Please note that these are just a set of guidelines and not rules which are mandatory. Even if you don't follow these guidelines, you would be able to achieve your most important task i.e. running the scripts to see if the application is working fine or not. The only thing is that you might end up spending a lot of effort scripting (if there is no code re-use) and maintenance would turn out to be a rather tough job.

Salient Features of a Test Automation Framework

Following are the features that should be available in a good automation framework.

a) The framework should be created in such a way that it helps achieve maximum possible re-use.
b) The test scripts should be easy to understand and maintain.
c) The framework should be designed in such a way that all different components such as test cases, function libraries, object repositories, data sheets, configuration files and test results are stored in separate folders. This would help the end users get hold of the framework easily.
d) Data parameterization should be done to keep the code separate from data, so that the same code can be re-used for different sets of data.
e) Test Results should make sense and should be easy to understand. You can also provide high level and detailed test results separately.
f) Proper error handling techniques should be used. You can also providing screenshots of the failed test cases.
g) When test cases are run in batch mode, failure of 1 test script shouldn't affect the execution of the remaining test scripts in the batch.
h) You can also write QTP AOM code in VBScript which can act as the starting point for the execution of test cases.
i) The framework may also include email (and if required SMS) functionality so that the test execution results are automatically mailed/sms'ed to the stakeholders.

Other than these features, you can also include various other features based on your requirements.

Frameworks used in QTP

Following are the different types of QTP Frameworks that you can use while creating test scripts.

1) Linear Framework in QTP - 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 manner.

2) QTP Functional Decomposition 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.

3) QTP Data Driven Framework - In this approach, your data is kept separate from the code, preferable in excel sheets. This helps you execute the same code for multiple sets of data.

4) Keyword Driven Framework in QTP - 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.

5) QTP Hybrid Framework - Hybrid framework is a combination of one or more frameworks discussed above. Based upon your needs, you can combine the features of any of the above frameworks. The resultant framework would be a Hybrid framework.

6) BPT Framework in QTP - 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.

This is the most recent post.
Article plus ancien


Vestibulum bibendum felis sit amet dolor auctor molestie. In dignissim eget nibh id dapibus. Fusce et suscipit orci. Aliquam sit amet urna lorem. Duis eu imperdiet nunc, non imperdiet libero.

Post A Comment: