In Previous tutorial, we have discussed on the introduction about Framework. Now we will discuss how to implement Framework in Selenium.
Objective:
- Framework in Selenium
- Importance of Framework
- Framework in Selenium
- Tools vs Framework
Framework in Software Industry
Now we have understood the basic knowledge on Framework. Let’s understand how it is working in Software Industry.
- Framework is working as a Platform for developing Software Application.
- It Provides the Basic Structure on which Programmers can code for Specific Purpose.
- It has some setup Rules and Best practices or protocol to manage.
- Framework is a platform which has all the tools, Libraries, Organized and set in the structure to enable testing automation.
Importance of Framework
Now we are clear what is Framework and how it is working. But why it is required? What is the importance of Framework?
- Stored in Single Location:
- Components are stored in a single location. This is the important importance of the Framework.
- All Data sets are stored in one location.
- All your test scripts are stored in one place.
- Like test script and Data set, all reports are also stored in single location. In this way, handling and managing the components will be very easy.
- Structured Manner:
- Apart from the storing in single location for each components, all components are also very structured manner.
- Easy to Maintain:
- Though all components in Framework are in structured manner, it is very easy to handle and maintain,
- Reusability:
- Some codes can be used many times in you script. Rather writing the same code multiple time in single script we can write the reusable code in a different component
- In this way redundancy of code will be less.
Framework in Selenium?
Framework in Selenium Consists of multiple components. Each components are organized in such a way that communications between each components are very smoothly and easy to maintain each components, Let’s have a look on the details about the each components of Frameworks in Selenium.
- Unit Test Framework
- Test Script
- Design pattern
- Utilities
- Test Data
- Reporting & Log
- Maven Tool
- Git Hub
- Runner

From the above diagram you can notice that, there are couple of blocks are marked as Green and some blocks are marked as Orange.
What does it mean?
All blocks which are marked as Green color are known as Components and the blocks which are marked as Orange is called as Tools which are required to implement Framework.
Let’s discuss one by one.
Unit Test Framework:
- To work with automation testing framework you need a unit test framework which will help you to write the test script.
- In this framework you can write the test cases, define the order of the test cases, define the parallel execution of test cases etc.
- Some example of Unit test framework are TestNG, JUnit
- In this component you will use the Test Script to write the Unit Test Framework.
- Addition to Test script, you need a Design pattern which will help you to arrange or separate the Test case and Page class. This design is generally called as Page Object Model.
- In Page Object Model, your Page class contains all the element and function to manipulate. In other side Test case file contains all the test case which can pick all the elements and methods from the page class file.
- This way, Our Test Script are clean and very easy to manage and maintain also.
Utilities:
- After we discussed about the Unit Test Framework, we can have another important component which is called Utilities.
- Utilities is nothing but a file which contains all common functionalities which can be shared with all other test case file.
- For example handling Screenshot, Browser Driver, Handling Exceptions like ElementNotFoundException, ElementNotVisibleException etc.
- Addition to defining all common functionalities in the Utilities file, we also have common standard libraries which can be used in all test case file.
- In a simple language if you want to define the Utilities in Framework, it consists of reusability code so that it will be shared with all test cases and each test script can access these code and shared among all test cases file.
- It will optimize your code.
Data Set:
- Data set is the most important component in the Framework. It is generally used to maintain the Test Data in your script. So that we will not use the data in our script directly hard coded.
- All Test Data which will be used in our Test Script can be managed in the Test Data file.
- Through Test Data file all our data will be handled dynamically.
- These data set can be stored in different format like xls, xlsx etc.
- On demand basis, we can import the file to our script through external plugin and access the test data.
- Another positive point of making the test data separate is if we need to change some sort of data then we can changed directly from the test data file and it will me implemented in our script.
- To work with Excel file for Test Data, we will use the Plugin called Apache POI.
- Through Apache POI, we will access the test data from the external Excel file and use the test data on required basis.
- In Dataset, you can use the Properties file also. This file is special file which contains all the properties details like URLs, Browsers, and other details.
Report & Log
- From the name of this component, you can guess the importance of this component of the Framework.
- After running the test cases, it is most important to analyze the report and log in case of analyzing any error and process.
- So Report & Log should be proper format so that it will be easy to analyze by the Techies.
- Through Framework, you can create the report in below format.
- XML Based Report
- PDF Report
- HTML Report
- Allure report
- Extended Report
- All the above report has individual importance. To work with different report, you need to use different libraries based on requirement.
- The special report in the framework design is “Allure Report”. Allure Report consist of both Report and Log. So if you are using Allure Report tool for your framework design then you do not need to use the Log tool separately.
Maven Build Tool:
- Maven build tool is another component of the Framework which is used to build you code and add all dependences of you Test Script.
- Out of all build tool, Maven is most popular building tool. With Maven, you can create your project build, dependences, documentation etc.
Git Hub / Git Lab :
- Till now we have discussed how to create the test script using the unit test framework, how to use utilities file and how to handle Test data by using Apache POI and so on.
- But where to store all those files?
- Yes We need a storage to store our code and scripts.
- Git Hub / Git lab helps us for this purpose in framework.
- With Git, we can push our latest change to the storage, can pull the latest code form the storage and We can merge the changes. In this way we can eliminate all the local dependencies among team members.
Runner:
- The last and foremost component in the framework is called Runner.
- We have all files, and all are stored in the storage. But how to run all those files.
- To run out test file, we need a runner, in software industry there are different runners exist. Some of are
- Jenkins
- TeamCities
- Bamboo
- Azure DevOps
- Out of these, Jenkins is the most used Runner tool for the automation framework.
Framework Vs Tools:
Now we have understood about the Framework in Selenium.
Some may think that Framework and tools are same. But actually framework and Tools are different and there are some relation between Framework and Tools. Let’s discuss on what is Framework and Tools actually is.
- Tools are generally used for specific functions in software. It has predefined input and output . But Framework is the super set of Tools, Framework can use different set of tools to create a complete application.
- A framework is a generic Architecture of an application in which Tools can work automatically. For Example Spring Boot, Django, Jason etc.
- In other words, Framework can be considered as a wrapper of set of libraries, files, tools which can be used in framework, so we need not to write the same functionality again in our Test Script.
- Framework can also give the extensive hands to the Programmer through which programmer an extend the functionality easily without writing the same code in Test script. He just need to use the framework and will reach the goal.
Summary:
- Framework is working as a Platform for developing Software Application.
- To work with automation testing framework you need a unit test framework which will help you to write the test script.
- In Page Object Model, your Page class contains all the element and function to manipulate. In other side Test case file contains all the test case which can pick all the elements and methods from the page class file.
- If you want to define the Utilities in Framework, it consists of reusability code so that it will be shared with all test cases and each test script can access these code and shared among all test cases file.
- we are using Dataset to maintain the Test Data in your script. So that we will not use the data in our script directly hard coded.
- The special report in the framework design is “Allure Report”. Allure Report consist of both Report and Log. So if you are using Allure Report tool for your framework design then you do not need to use the Log tool separately.
- With Git, we can push our latest change to the storage, can pull the latest code form the storage and We can merge the changes. In this way we can eliminate all the local dependencies among team members.
- Jenkins is the most used Runner tool for the automation framework.
Now we have discussed about Framework in Selenium.
Thanks for being a viewer. Did you find this tutorial useful? Please consider letting us know by leaving a review. We know you’re busy, so we’re just asking you to leave a fast with feedback in comment section. You can also contact us in whatsApp and by email to pratik.mishra@testinglpoint.com.
Pratik.mishra, Thankyou so much for all your Best Efforts…Could navigate to your site from facebook ..One Best place to Learn Selenium &its Extended family in a easier and simple way is from TestingLPoint…Much Thanks for sharing…
Great Explanation.