Framework development is an integral part in automation testing and there are many advantages when we shift to a framework. Without using a framework all our code and data will be in the same place and thus restricting us from code reusability and easy maintenance.
We will briefly go through each of the frameworks currently been used:
Data Driven Framework:
In Data Driven framework all our test data is stored in from some external files like Excel, CSV, XML or Database tables. This way we can run our automation scripts multiple times using different test data stored in any of the input files. In our last example, Second Test Case, we hard coded the test data like ‘Selenium’. What if someday we want to modify our test case to search for a different text? We will have to go to each of the test cases to update the input value. We can avoid this situation if we store the input value in any of the files mentioned and refer that file to our test case. This will resolve our issue to some extent. We will do a detailed analysis on this topic in our next post.
Keyword Driven Framework:
In Keyword Driver Framework all the instructions or steps are written in an Excel sheet. For example in our Second Test Case, we have the first test step to open the browser. Corresponding to this step, our Excel sheet will also have the step ‘openBrowser’. Code for this ‘openBrowser’ will be written in a separate class file. The idea behind the Keyword Driven approach is to have all the instructions written in an Excel or in other words to have the test cases created in Excel and then execute these instructions. This way we can easily manage the test case by updating the Excel. For better understanding of the framework, we will do a detailed analysis in upcoming posts.
Page Object Model:
Page Object Model or POM is a concept where we will create separate class files for each page of our test application. This Page class will have all elements associated with that web page and will also contain methods which perform operations on those elements. If we take the case of our first test case, there will be one page class for Google Search page. This class will contain all elements like the search text box, search button etc. The class will also have a search method which will actually click the search icon for doing the search. As we move on to a different page, we will have a new page class with all elements and methods of the new page.
This way the code gets cleaner, easy to understand and also easy to maintain.
Hybrid Framework:
Hybrid Framework is a combination of more than one above mentioned frameworks. We will also use TestNG for setting up this framework. Once we are familiar with above three frameworks, Hybrid Framework will be easy to learn. We will do detailed analysis on this one too.
Behavior Driven Development:
Behavior Driven Development or BDD is the latest framework that is very popular with Agile methodology. Using this framework we will write test cases in easily readable and understandable format to Business Analysts, Developers, Testers, etc. We will use Cucumber to set up the framework and Gherkins language to write test cases in Cucumber.
So keep learning friends, many interesting topics to follow…