A test automation framework is a set of concepts, rules and best practices which can follow in a systematic way to achieve the desired results. There are different type of automation framework
- Data Driven Framework
- Keyword Driven Framework
- Hybrid Framework
- Page Object pattern framework
- Data Driven Framework: Data-driven framework is nothing but performing the same functionality with multiple input values by using parameterization with the help of data table or data source is called Data Driven Test.
Example: we want to test the login system with multiple input fields with 10 different data sets.
To test this, you can take following different approaches:
Approach 1) Create 10 scripts one for each dataset and runs each test separately one by one.
Approach 2) Manually change the value in the test script and run it several times.
Approach 3) Import the data from the excel file. Fetch test data from excel rows one by one and execute the script.
In the given three scenarios first two are laborious and time-consuming. Therefore, it is ideal to follow the third approach.
Thus, the third approach is nothing but a Data-Driven framework.
- Keyword Driven Framework: The Keyword driven testing framework is an extension to Data driven Testing Framework in a sense that it not only segregates the test data from the scripts, it also keeps the certain set of code belonging to the test script into an external data file.
These set of code are known as Keywords and hence the framework is so named. Key words are self-guiding as to what actions needs to be performed on the application.
The keywords and the test data are stored in a tabular like structure and thus it is also popularly regarded as Table driven Framework. Take a notice that keywords and test data are entities independent of the automation tool being used.
Example: For example keywords like login, clickLink and verifyLink are defined within the code.
- Hybrid Framework: This framework is a combination of frameworks between Keyword driven and Data driven framework.
The most significant advantage of hybrid testing frameworks is it’s hybrid nature. Because they combine benefits of all associated testing frameworks, helping professionals to leverage all that’s best about them in a clear-cut manner.
- Page Object pattern framework: It is up to date smart concept framework as create a separate class for an individual page and put all the belonging objects of that page.
Example: For a Home page create a class name as ‘HomeClass’ & put all the objects paths and related method (so that you can call those method from Test class) of that home page inside the HomeClass. Repeat the same things for other pages.
Advantage of Page Object Pattern are:
-Easy to maintain.
-Easy readability of scripts
-Reduce or eliminate duplicity
-Re-usability of code
How to choose the right testing automation framework?
There are several aspects developers look for when choosing the test automation framework for their project. Here are some of the most important ones to consider before you make your decision:
- Adaptability – this is one of the top criteria for a framework to choose how easy to adapt it’s nature considering build, deployment and user learning curve (focusing on the complexity of the framework and development language)
- Re-usability – a key value of test automation frameworks that allow you to reuse the same code again & again whenever it needs for doing the same job or functions.
- Reporting – the ability of a framework to produce reports in details, but also logging information as well ability to transform reports to other storage or format
- Extensiblity – whether the framework can be extended in case it lacks a key feature, how it integrates with other frameworks or components under test, how many libraries are available and whether it’s easy to create various scenarios or test cases for scenarios
- Supported environments and platforms
- Integration with CI- Works with other CI/CD tool, eg: Jenkins
- Readability – Easy to read the code following coding standard, eg: Uses comments, indentation and so on.
- Easy maintenance- Central control what makes easy to read the code, change and update.
- Support – the community support available through online, Social Media and blog for a particular test automation framework using existing documentation, video tutorials to help leverage all the benefits related to that framework.