Khanh Hoang - Kenn
Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.
This page is your one stop repository for all the information about the different aspects of QTP frameworks. Here, you will find in-depth articles explaining the different types of QTP frameworks in detail. These articles contain illustrative diagrams, code snippets, real life project examples and sample frameworks available for download.
This page contain a lot of articles targeting different types of QTP frameworks. The contents in this article are arranged in such a way that it starts at an easier level and then tackles intermediate/complex code.
If you are a beginner on QTP and have very less or no experience of actually creating automation frameworks, I strongly suggest that you first go through this article first. After that you should go through each of the links given at the end of this page (in the order in which they appear). This would help you build a solid foundation and you would be able to understand the complex frameworks with ease.
If you have good expertise in QTP and have worked on QTP frameworks before, then you can directly jump over to the article which you wish to read. Alternatively, you can quickly go through the different links and see if you can utilize some concepts in your own frameworks.
Before you begin, you need to understand why a framework is important when you do some sort of test automation. Consider the following scenario. Suppose that you have been asked to create test scripts for an application. As an automation engineer, what would be the expectations that you would want to meet while you do this work?
The most important thing is that the test scripts 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 is scalable? All these are the features which if you have, makes your life much more easier. And how do you achieve all these things? Well, all this can be done by using a proper Automation Framework.
QTP Framework, or in general a test automation framework, is a ‘set of guidelines’ which you can follow during scripting to achieve the above mentioned ‘desired’ results. These set of guidelines can be anything such as -
a) coding standards. For example, the variables names might begin with the type of variable (eg. intNumber, strMessage, arrArray), function names may start with fn (eg. fnCalculateSum)
b) structure of your data sheets, how your workbooks and the individual sheets in them are grouped together
c) what folder structure you should follow to store the test scripts, reusable libraries, object repositories, test run results
d) how should test run results be stored and displayed, whether you want to overwrite the test results every time, or you want to save all the test runs separately
e) how different team members should access that shared repositories, libraries and how they should update these
f) and many more….
If you follow these guidelines, your scripting work would be done in a consistent manner. And this will ultimately result in a framework which will provide you with all the benefits that you had aimed for initially.
Please note that these are just a set of guidelines and not rules which is mandatory for you to follow!! 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 disadvantage is that you might end up spending a lot of effort on maintaining your test scripts.
Following are some of the important features that should be available in a good automation framework.
a) The framework should be designed in such a way that it helps to achieve maximum possible re-use. For example, if there is some code that needs to be re-used multiple number of times, then you should create a function for that code and call the function wherever required.
b) The code should be easy to understand and maintain. This is an important requirement because in most of the cases where you have a framework being used for a long duration of time, there would be many people who would be a part of that project at different time intervals. And hence, your framework should be such that the new people don’t find it very difficult to understand the code and the framework flow.
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 understand the framework easily.
d) Data parametrization is another important feature that should be a part of a good framework. With data parametrization, your test data would be kept separate from the code. And this will ensure 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. One advantage of this is that your client will not be interested in the detailed results. For them, the ideal thing would be to present a report that just lists out all the test scripts and specifies which ones from them have passed and which have failed.
f) Proper error handling mechanisms should be employed. You can consider providing screenshots of the failed test cases. These screenshots can be used for defect tracking purposes.
g) When you run the test scripts in batch mode, the framework should have a provision wherein if one test script fails, QTP shouldn’t get stuck there. If a test case fails, QTP should report out the error and then move over to execute the next test case.
h) You can also add the feature for automatically sending an email (or SMS) to the intended parties after completion of test script execution. This feature can be configured in such a way that as soon as your batch execution is complete, the framework will automatically send an email to all the stakeholders. It would be a good idea to send the test execution result as part of the email.
There are some of the common features that are generally used in a good automation framework. So, when you try to create your own automation framework using QTP, you should try to use as many of these features as possible. Other than this, there are some other features also, which you can use as per your requirement.
This section provides a list of all the different types of QTP frameworks. For each type of QTP framework, we have provided a basic description about that framework type. This is followed by one or more links for each framework types.
Each of these links contain a detailed article about that QTP framework. These detailed articles include lot of code samples, illustrative image and sample framework code which you are free to download and use in any way you want.
Basics of QTP Framework (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.
Links:
eBook (PDF) – Basics of QTP Framework
1) 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.
Links:
QTP Linear Framework – Complete Guide with AOM example
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.
Links:
Designing QTP modular framework from scratch
3) 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.
Links:
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.
Links:
5) 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.
Links:
(final article link coming soon)
6) 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.
Bình luận (0)
Add Comment