Pages

Tuesday, February 25, 2014

Test Automation Framework

If you search on Google about automation framework it will show you lots of definitions and I found many of them useless in respect of manual testers. Let's discuss about the automation framework with definitions and some examples.

Here are few examples from Google. 

http://www.ibm.com/developerworks/rational/library/591.html
 " A test automation framework is a set of assumptions, concepts, and practices that provide support for automated software testing. "

http://en.wikipedia.org/wiki/Test_automation
" A test automation framework is an integrated system that sets the rules of automation of a specific product. This system integrates the function libraries, test data sources, object details and various reusable modules. These components act as small building blocks which need to be assembled to represent a business process. The framework provides the basis of test automation and simplifies the automation effort. "

http://www.automatedtestinginstitute.com/home/index.php?option=com_content&id=1096:faq-framework&Itemid=25
" An automated test framework may be loosely defined as a set of abstract concepts, processes, procedures and environment in which automated tests will be designed, created and implemented. In addition, it includes the physical structures used for test creation and implementation, as well as the logical interactions among those components"

OK, so we have some definitions did you understand any of them? The definitions looks bit technical and all of them are giving almost same meaning, or if you search more you will find similar which may leads to loosing your interest end of the day. I will give some practical examples which we usually see everyday and will try to relate with automation framework definitions Or you can understand them by yourself. 

Garage "Where motor vehicles gets fixed"

In a garage motor vehicle gets fixed but how? Is there any process involved? Yes. may be you don't see the process. But I will tell you how, if you noticed a garage you will find the set of tools, equipment, parts all are kept with proper arrangement and when any motor vehicle comes it makes it easy to find. Mechanics check the problem and pick the right tools to fix it. But he follows some procedure, like how to open Tyre, How to open front hood of car, how to fix the problem and when done he re-arrange the equipment and closes the open part of the vehicle. So his garage is his framework which is supporting him to fix the car.. got it? it is not a rocket science a very simple and straight forward concept.

But how it is related to automation framework? Yes it is related, the definition says "automation framework is a set of assumptions, concepts, and practices" very technical but with the below explanation you can relate yourself 

An automation framework which provide tools, like start/close Browser, Write Logs, Navigate URL, Capture screenshot, put some delay between steps, check internet connections, check internet speed, get UI elements etc. An Automation Framework doesn't know which one you will need so, it assume you may need these in order to you automate your requirement but depending on the type of automation framework it can have different set of tools.

In your framework you got the right tools or the building blocks now your next job is to automate test cases. So you need some rules, like how do I start writing test cases, which language should I use, what are the procedure to write test flow, how to initialize things (like browser, or some data) how you will organize your tests, what is your application and its flow. So accordingly you will need create your tests scripts. 

You got the tools, and rules to automate your tests. Finally you need something to execute those tests and get the results. (In QTP or other coded UI tests you get all of these together and you need not to worry about tools, rules and how to execute. But here we are not using any framework, so how we'll design our own. This is pretty difficult at the moment but we'll see in other posts how it is easy.) There is a component in automation testing called Test Harness. I will cover in later part. Either I can use any available test harness or I can write my own (what! writing test harness, is it a joke?) Yes you heard it right. This is simple but depending on your need it may be complicated. So why don't we use which is available. I will also demonstrate to write your own harness. 

Painter Board

Imagine a painter board, it has lots of things together like, a big board, a clip to hold the paper, a stand to keep the brushes, a color holder, a height adjustable knob etc. This whole is a framework for a painter because he is getting everything together to make multiple paintings. The same can be related with automation framework or any kind of framework in software industry.

Summary: In simple sentence a test automation framework is combination of tools, rules, and test harness. which helps you to automate your test cases. You can check my next post for practical examples of framework. Don't complicate this with Google's definition keep it simple.

Test Harness

This is something new, some people know some people don't know. Lets say I have created many .exe files or .dlls which has some test cases. If i want to execute them I need someone to execute them one by one and collect the results. But it is annoying or better to use manual testing, isn't it? What I mean to say if I have something which executes these exe, dll or jar files and collect the results then it will be my test harness. 

For example in QTP when you record a step on browser and play, then from the play your test harness comes into picture. It executes them and collect the results. But it is collectively a part of your test automation framework only. Similarly in VSTS or other framework.

Hope I explained it more.. but if you have any questions you can comment I will try to clarify. Or if you feel this article could have been better I will love to hear your suggestions. 


1 comment: