Introduction to Frameworks
A framework is the core structure of any environment. It can be a testing environment, or designing a web application or developing some windows based application.
Designing a framework means defining a standard of writing codes. Without a framework, the code will be written in a haphazard manner, which is neither reusable nor readable.
Frameworks reduce the rework of writing code, provides high portability, reduced script maintenance, etc.
A Framework must provide an ability to generate reports of test runs and show it in easy to read format, may it be in Excel format or an HTML format.
It must have the capability to take a screenshot of failure scenario’s which can help in debugging later.
It must have a logging functionality to log all the activities in INFO, DEBUG, ERROR modes.
There must be a standard defined and maintained while designing frameworks which includes the way of designing libraries, logging formats, reporting formats etc.
There are three major frameworks famous in market:
- Data Driven Framework
- Keyword Driven Framework
- Hybrid Driven Framework
Data Driven Frameworks are one which derived from test data. Test Data can be kept in some external excel file or text file or properties files or some Database.
Let us consider a scenario where you have to fill up signup form for some website for ten users. In this case, the information required can be kept in an external Excel file and then calling the test script to ten times to achieve it.
Keyword Driven Frameworks are one which is derived from keywords. Keywords can be defined at a generic level or application level.
Each keyword in a keyword driven framework has a special meaning or it performs a specific task.
Generic Level Keywords:
openBrowser – It will open a browser of your choice.
clickElement – This keyword will invoke a method which will click on a specific WebElement.
Application Level Keywords:
loginToGmail – This keyword will invoke a method to login into Gmail application.
Hybrid Driven Frameworks are one which has a flavour of both Data Driven and Keyword Driven Framework. They run on keywords and read test data from an excel sheet or database.
Thus it has a benefit of both data driven and keyword driven framework. Hybrid driven framework
Hybrid driven framework architecture is capable enough to handle most of the scenarios simple or complex.
Now we will design all the three frameworks.
PS: For any questions, queries and feedback, feel free to write us at firstname.lastname@example.org or email@example.com. Happy Learning ?