What is an Automation Framework?
Today's agile environment requires rapid application development and testing. There is a need for testing applications as soon as they get built and deployed. Testing is no longer a stand-alone activity. It has to get integrated with the development process. It is simple to code and create a one time automation script but making it reusable is what makes it worthwhile. This is where a framework comes into picture. A framework is a collection of rules that simplifies coding, increases re-usability and reduces maintenance. An automation framework at a high level is the folder structure that helps identify the various pieces such as source code, configuration files, captured images, data files, Utilities and so on. It
gives us a skeleton to work with. Apart from the folder structure, the automation framework is also a set of rules set aside for development and guidelines for working with these rules.
Why is an Automation Framework required?
Linear scripting is coding without taking re-usability into consideration. This involves writing the script for automating a webpage in top to bottom fashion. Linear scripting, as they call it is good for a one time test. If our goal is to design a regression, smoke, sanity test pack, linear scripting approach wont work. If linear scripting is used, it will result in code duplication and very high maintenance. With an automation framework, we have re-usable methods which will reduce the code duplication and maintenance. If you take a screen with 5 drop downs with dynamic ids, 10 text boxes with name attributes, buttons with dynamic locators, it will be very difficult without a framework. You will need to write property
file lookup methods for accessing the properties files for configuration and object repository, fetch methods for excel, write methods for text files and reports. A framework has all this created as a one time effort in predefined folders in the folder structure. Once the bare bones for the framework are created, it becomes extremely easy to build upon it for any automation development effort. We will be exploring many techniques to create a highly structured framework that can be reused in multiple projects with minimal customization.
Benefits of implementing an automation framework
One might think what benefits does a framework have over linear scripting. There are many, out of which few have been listed here
1) Understanding - Suppose you have a team of 3 automation developers (Mark, Steve and Jon) who have developed a good framework and now a new team member(Christy) joins who has moderate experience on programming. If a framework did not exist, each module owner (automation developer) would have to sit with the new person for a knowledge sharing session of his module and his program structure. With 3 different program structures, the new person will feel confused and the level of comfort will get reduced. With a framework, someone from the team can help the new person understand the overall structure of the framework. As far as the details of code in the framework goes, the new person can analyse the code at his own pace at another time.
2) Modularity - Take a fictional scenario where the Login page has a Remember Credentials checkbox added. The task of automating this checkbox has been assigned to Christy. Since Christy already know about the overall structure of the framework, she can go directly to the page object package inside src folder, locate the Login page object and make the required changes.
3) Easy to code - Since the code has been designed in a modular fashion and we have reusable methods for common functionality, Kristy finds it very simple to just call the reusable methods on the new object.
4) Scalable - Whenever new pages, objects or data are added, the framework should be easy enough to modify and expand. This way, it can be used for small and large projects alike.
5) Coverage - A framework allows us to use various combinations of data thus helping to expand coverage.
6) Cost - When the framework is being developed, the project cost will be high due to no of resources involved. In our case there are 4 team members. Each person works 5 days for 8 hours. Suppose the total framework development effort has been roughly estimated as 2 months(4 weeks per month ie total 8 weeks X 5 day per week = 40 days), the total man hours will be 1280(40 days*32 person hours per day). This is a considerable figure. But once the framework is developed, customizing it might be a single person effort in our case. So there is a significant reduction in cost.
7) Reporting - Reporting module in our framework can handle all reporting requirements. This report can be excel, csv or third party such as XSLT or Extent reports.
8) Error Handling - This is easy in a framework where one knows in which module the error has occurred.
9) Continuous Integration - A framework helps in case it has to be plugged in a CI tool like Jenkins.
Types of Automation Frameworks
1) Linear Framework
2) Modular Framework
3) Data driven Framework
4) Keyword driven
5) Hybrid
6) BDD Framework
7) Page Object Model Framework
One can find the explanation of these frameworks on the web. Since this blog is about Page Object Model, we are going to focus on the page object model from the grounds up.
No comments:
Post a Comment