QTP Framework, or in general a Test Automation Framework, is a set of
guidelines which can be adhered to 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. intNum, strMsg, arrArray), function names should start with fn
(eg. fnCalculateSum). - format of your data sheets, how your workbooks and the
individual sheets in them are arranged. - what folder structure should be
followed to save the test scripts, reusable libraries, object repositories, test
run results. - how should test results be saved and displayed. - how all team
members can access that shared repositories, libraries and how they should
update these. - and many more..
Following these guidelines would lead to the job being done in a consistent
manner which would ultimately result in a framework which will provide you with
all the advantages that you have aimed for.
Please note that these are just a set of guidelines and not rules which are
compulsory. 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 nightmare.
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 designed in such a way that it helps achieve
maximum possible re-use. b) The code 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 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 multiple sets of data. e) Run 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, failure of 1 test case 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
can also include email (and if required SMS) functionality so that the test
results are automatically mailed/sms'ed to the required people.
Other than these features, you can also include various other features based
on your requirements.
Different Types of QTP Frameworks
Following are the different types of QTP Frameworks that you can use while
scripting.
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 step by step fashion. 2) QTP Modular Framework - With this
framework, you write the entire code into different functions and then you call
these functions as and when required. These functions can be both reusable and
non-reusable. 3) Data Driven Framework in QTP - 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) 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. 5) Hybrid
Framework in QTP - 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. 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. |