Hello Friends!
In this post, we are going to discuss about Automation Framework! I'm not going to write any bookish definitions here. It's all what I learned from practical experience.
Okey!
First thing first...
What is framework?
Automation Framework is a set of guidelines and process you use to manage and optimize your automation testing. In simple words, Framework is a way to do the things in fashioned and organized manner! Framework is nothing but a concept.
It's always possible to work without framework but you'll be doing a lot of rework, everything will be here & there and in most of the time you will end-up with a mess, specially in the large projects.
Framework lets you predefine your automation plans, strategies and how you are going to proceed.
Types of Framework:
Framework can be of several types, but here are three main types of frameworks-
1. Keyword driven framework
2. Data driven framework
3. Hybrid framework
But this is only theoretical. Practically, there is no 'Chinese Wall' between the framework types.
In every organization you work, you'll find that it's quite different from the other and not only on organization level, you can feel the difference within different projects!
Yess, but most of the them could be mapped with Hybrid type and I like it!! :)
Hybrid framework has no boundaries and open to take benefit of all possible type of frameworks.
How to design a framework?
I have done a lot of automation projects and designed a lot a frameworks, but seriously guys, I never used any particular type of framework!
Practically, every application/project has its own expectation. You just need to start your work in organized way and believe me friends, at the end of the day; your framework will be ready automatically!! Sounds crazy??
You can't design a complete framework and then start automation! You start automation and framework will start building simultaneously.
The first step of any test automation framework is to do a quick POC with few high priority test cases. By doing POC, you will identify the object identification issues, challenges, complexities, required test-data and limitation you have. Once you are ready with this information, you can proceed with next steps. On the basis of above information, you can decide what type of framework is most suitable to you.
But before starting, you must take some time to decide your strategies about..
1. Object Identification
2. Test-Data
3. Function Library
4. Error Handling
5. Controller script
6. Documents and Manuals
1. Object Identification:
How to identify objects i.e. using Object Repository or Descriptive programming or both. As per my understanding, dont't try to stick on one particular. Depending on the application/object types, mixed approach is most fruitful most of the time.
2. Test-Data:
How to manage you data? DataTable or Excel or may be flat/csv files.
3. Function Library:
Be clear about what type of function libraries you are going to use and why.
4. Error Handling:
Whets your plan to handle errors? Be clear about it.
5. Controller script:
Design a controller script, which will control all your automation. It should be neat. This helps to understand what actually you are going to call.
6. Documents and Manuals:
Keep all the documentation, user guide/manuals, keywords descriptions here.
Create different folder for the these six things and keep data in folders accordingly.
This was the one part.
Apart from this, from first day of your automation, keep only one thing in your mind.. follow general good practices!
Here are are few points need to be take care in designing successful framework.
- Try to document each and every thing, as much as you can! like comments in script, modification etc.
- Don't stick with any particular object identification, use mix of OR and DP
- While using OR, don't use record and playback, just add object in the object repository and code the script manually.
- Follow proper Naming-Conventions for all your variables, functions, files.
- Define all the variables in you scripts, use Option Explicit.
- Try to keep you functions small to enhance reusability and portability.
- Never hard code any data in the scripts, use parametrization.
- Take regular back-up of your work.