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.
Some standard frameworks famous in the market:
- Data Driven Framework
- Keyword Driven Framework
- Hybrid Driven Framework
- Modular framework (developed with enhanced POM – page factory) – Very important
Data-Driven Framework is the one derived by 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 a 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 Framework is the one which is derived from keywords. Keywords can be defined at – a generic level or at the 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 Framework is one which has a flavor 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 architecture is capable enough to handle most of the scenarios simple or complex.
One of the frameworks which is famous these days in the market is the one shown below which has most of the features required in a good framework like –
Reusable and readable code, Easy to maintain code (using POM – page factory as the design pattern), Integration with latest and trending tools like TestNG, Extent Reports, Integration with CI/CD tool – Jenkins.
To get more idea about this framework, please go through the below video:
PS: For any questions, queries, and feedback, feel free to write to us at firstname.lastname@example.org or email@example.com. Happy Learning 🙂