1. What is Automation?
Controlling one application for another application.2. What is Framework?
A structure which consists of all the building blocks for developing an application.3. What is Automation Framework?
You are going to use the building block of structure to develop application which is going to control another application.4. Background – Object Oriented
If you have done development in any OO programming language then you can easily understand the concept of Framework and Automation. Take a simple example of Calculator. Can we call it an automated tool? Yes it is. You know why, because it controls the simple and scientific calculations.If you are asked to develop a program like calculator in any OO language, then you are going to make use of many pre-existing library, their methods, properties to accomplish your goal. Now these library or readymade utilities can be bundles in a framework and you just make use of that framework to execute your task.
5. Test Automation Framework
Come to the point and talk about automation framework in testing. Today a no. of testing tool is available in the market and I am going to discuss about one of the widely used tools for automation which is HP Mercury QTP. How you are going to develop an automation framework in QTP.Well you have heard of Keyword driven and Data driven methods which is considered as an Automation Framework. But I am not in agreement with this view as they do not fulfill the requirement of an Automation framework as whole. It’s Ok that using above methods you can accomplish specific task as per your requirement and you can reuse it in a same application but you cannot make much of it in another application having different requirement. Then what is the use of such a framework, which cannot be extended to fulfill any task.
In next para, I am going to talk of a Framework which can be extended to fulfill any automation task in QTP. I would like to call this as XP Framework - the framework which is extendible in real terms.
6. Beyond Paradigm – XP Framework
I would explain the above framework taking a very simple example. In most of the application you will find a presentation layer, business layer & database layer. XP Framework (as I called) talk of extending existing utilities available with QTP to fulfill the above architecture.6.1. Presentation Layer (PL) Framework
Develop a library which is going to take care of your presentation layer. Now you will say QTP has already taking care of it. I will ask you how many shared repository you are maintaining for 5 different application you are currently working on. You will say 5. Why 5? Why not a single library for maintaining the repository for all your 5 applications? Never ever think of it. No problem.Develop a list of object in web-based and desktop based application. The list could include text box, label, list box, combo box, radio button, checkbox, command button, image etc.
For e.g. Consider a login page which has 4 controls, 2 Input Box and 2 command buttons.
When you record your script make use of above control in developing a common library which can be fit into any similar login page in different application.
Every control has some properties and it belong to some object class. You goal is to make use of property and develop procedure so that you can set the property of these controls at run time.
When you record an event on a particular control the tool generate script for your actions and then you start working on these generated script by modifying, making it reusable, modular etc. Great Job you are following Data Driven model. What if you are asked to test the same functionality in different applications with same control but different properties, event etc?
You start recording and again start modifying your script. Why not we focus on developing a Presentation framework which should be application independent?
For e.g. “Object (Property, Action/Event)”. Here Property & Action/Event refers to all the Property and Action/Event supported by the underlying object. Give more thought over it as this method is time taking but once developed must give a good ROI.
6.2. Business Layer (BL) Framework
You have developed a presentation layer framework, now how PL and BL is associated. PL is used for user activity or input. The user input via PL carries some functionality which is also a part of requirement and thus testing. How you test this business layer where you have to apply logical thinking?Here comes the old logical blocks of If, Else. Take an example, if I have to test “Age of a person cannot be less than 13 years while creating an email account”. Think about what are the objects, actions and input linked with above functionality while testing.
We already generated the PL, now using PL, provide the input and verify that a proper error message get displayed when user is trying to provide an age which is less than 13 year old.
Creation of a reusable business layer is time taking and evolving. You always have to make note of most common business function across all applications. Business Functionality are not always the same, so you have to make logical business unit and then put all your observation for the business unit on ongoing basis and soon you will find that you have created a library of Business Unit which can easily be reused in matching applications carrying same business functionality.
If one is going to automate the above functionality in QTP, then s/he is going to record the above functionality alongwith the error message. Good, that is the right way but I am going to put that If…else block to make it more reliable. For e.g. first I am going to give the script name “AgeLessThan13YearsOld”. This way I can easily find out all the business related script and can run it at any regression cycle. 2 more things I am going to incorporate to make it more reusable. First the input of age and verification of message.
Make the script with 2 arguments, one is age which can be used as input in your script and other is the expected message which get verified with the actual message and the result get reported. This design will ensure that if in future business changed from age 13 to age 15, I just need to change my arguments in the script and nothing else.
6.3. Database Layer
The last layer is the database layer which store the information passed via the presentation layer, filtered through business layer. What you are going to verify in your database. If you are spending time in verifying the entered data in the database using QTP, I will say it useless. You can easily verify it by directly opening the database table.For e.g. if you are testing a search page, then
You can check the total no. of records returned via a query should match with the results returned on PL.
7. QTP – Itself a framework – Shifting Paradigm
QTP is itself an automation framework which help user to fulfill automation task for testing. We are making use of various features of this framework and trying to develop another framework above oneJ.What we are trying to do? We are trying to fulfill some business tasks of testing. We are developing script, modifying the script, making it reusable and numerous activities. These all are procedure and we are making use of QTP Framework.
The Automation Framework is an industry buzzword and nothing else.
The industry is calling below mentioned as framework and I am not in agreement with it:
Test Script Modularity
Test Library Architecture
Data-Driven Testing
Keyword-Driven or Table-Driven Testing
Hybrid Test Automation
Why we call the above model as a Framework. We solve the business problem using above models in QTP or similar automation tool (which I am calling as an Automation Tool Framework.)
What I am talking may sound rubbish but I am talking on basics. Why we do not call MVC, N-tier and other architecture a framework? Why we call dot net as framework because we solve business problem using Dot Net Framework following some architecture which is reliable, maintainable etc.
Even the framework which I mentioned over here is just an extension of QTP Framework.
The above views are mine and you may or may not agree with it. The views and opinions give may or may not be useful for you in real time scenario.
Your views are most welcome.
Comments
Your post is really good and informative but as we know that QTP is very popular and widely used and due to this lot of materials are available for it.
It will be really good if your site would initiate discussions on some open source testing tools or tools which are not widely used but they very good like "Test Complete".
It is mere a suggestion.
Thanks
Kundan
This is really good post. They way you comeup with framework will useful for many automation projects. This will speedup the scripting and reduces the maintainance. In near future we will see more applications of this.
Good job and keep it up.
Naresh Veeramachineni