Designing Hybrid Framework in QTP – Part 1
In the previous article on QTP Hybrid Framework, you saw the hybrid framework from a generic point of view. That article highlighted the very basic information about hybrid frameworks, such as – what a hybrid framework is, its structure and some important features that are common across multiple hybrid frameworks.
Starting with this article, we will explain the step by step process that will guide you to create your own hybrid framework from scratch. The framework will incorporate some of the features that we had mentioned in the previous article. This step by step process will be detailed and will span across 2 to 3 articles. Let’s start with whats in store for this article.
Topics that will be covered in this article
In this article, we will cover the following topics on Hybrid Framework –
- 1) Components that would be used to create this framework
- 2) Features that would be a part of this hybrid framework
- 3) The flow diagram of the hybrid framework
All the above topics would serve as the basic building blocks that would help you understand and relate to the bigger picture with ease.
Components used to create this framework
Below is the list of all the components that will be used to create the hybrid framework. A short description accompanies each component.
1) VB Excel Macro: The VB excel macro will act as the starting point for running the test scripts. How it would work is like this – There will be an excel sheet which will contain the list of all the test cases. There will also be an ‘execute’ button in the excel sheet.
If you want to run the test scripts, you will need to click on the ‘execute’ button. This execute button will have a macro attached to it. So when you click on the button, the macro will open QTP and load the first test case to it. It will then instruct QTP to execute the test script.
The same procedure will be followed for all the test cases that are available in the excel sheet. The excel macro will use QTP AOM (automation object model) concepts to interact with QTP.
2) Excel Sheets: Excel sheets will be used extensively by the hybrid framework that we would create. Excel sheets will be primarily used to store the following information –
- a) Test Case List: As mentioned above in point 1, a list of all the test scripts will be maintained in excel sheet. This will be used for batch execution.
- b) Test Data: All the test data would come from excel sheets. No test data will be hard-coded anywhere in the test scripts.
- c) Test Results: Excel sheets will be used to provide a summarized result of batch execution. Here, the excel sheet will simply contain the list of test cases that were executed together with the information about whether the test scripts passed or failed.
3) Test Scripts: These are the actual QTP test scripts. For each scenario that you would automate, you would need to create a separate QTP test script.
4) Function Library: This hybrid automation framework will use two separate function libraries. The first function library will store all the generic functions (application independent functions). Some examples for this can be functions to click on a link, to enter value in a text field etc.
The second function library will contain application specific functions. Functions such as login, logout etc will be a part of this second function library.
5) Object Repository: All the object definitions will be stored in the object repository. There will be minimal use of descriptive programming concepts. Having said that, we will try to incorporate descriptive programming at some places so that you can get a feel of how you can use both object repository and descriptive programming together in the same place.
Salient features of the hybrid framework
Following are some of the important features that you will see in this hybrid framework.
1) This framework will be optimized for batch execution. This is what most good frameworks are all about. With this framework, you will be able to easily select the test cases that you want to execute in batch run.
2) To execute your test scripts, you would not be required to open QTP. This would be taken care of entirely by the driver script (excel macro).
3) As mentioned in the previous article, this framework will provide the test execution results at two different levels – summarized results and detailed results.
4) The test execution results from multiple runs would not be overwritten. Each test execution result will be appended by date-time stamp so that it can be referenced whenever required.
5) The hybrid framework will have the provision to automatically send emails (with the test results) after completion of a batch run.
6) The framework will contain an external configuration sheet which will help you to configure many of the features of the framework without having to touch any of the code.
Flow diagram of the framework
The below image describes the flow diagram for test script execution in the hybrid framework that we will create.
1) Execution of the test scripts start from the VB excel macro. Once you click on execute button in the excel sheet, the macro iterates through the excel sheet to find out the test case that needs to be executed.
2) Once the macro finds the test case, it loads the test case into QTP and “asks” QTP to execute that test case.
3) QTP (with the help of function libraries, object repository and data sheets) executes the test case.
4) After the test case is executed, QTP sends the control back to the driver script. Driver script then loads the next test case into QTP.
5) Once all the intended test cases have been executed, driver script creates the test results and stores it into its corresponding folders.
6) The driver script then sends an email to all the intended recipients.
This was all about the features, components and flow diagram of the hybrid framework that we will create. The next article will focus on the most important part of the process – the actual creation of the framework. That’s all from our side. Do let us know your thoughts on this using the comments section.
If you enjoyed this article, you can join our blog to get new articles delivered directly in your inbox.
Visit QTP Frameworks Main Page for more articles on QTP Frameworks. You can also visit our QTP Tutorials page for detailed QTP Tutorials.
Pingback: QTP Framework Tutorial - Framework Types, Examples & Sample Code - Automation Repository()
Pingback: Designing Hybrid Framework in QTP - Part 2 - Automation Repository - Automation Repository()
Pingback: Designing Hybrid Framework in QTP β Part 2 | Tech Lessons()