Selenium Framework

Selenium Framework

Define selenium

Selenium is an automated software testing tool for free and portable software to test web applications. It has the ability to operate in different browsers and operating systems. Selenium is not just a single tool, but a set of tools that helps testers automate web-based applications more efficiently.

What is Selenium Framework?

Selenium Framework is a code structure. It helps facilitate code maintenance. Without a frame, we will place the “code” and the “data” in the same place, which is not reusable or readable. In most cases, the use of Frameworks produces beneficial results, such as greater code reuse, greater portability, lower script maintenance costs, greater code readability, etc. There are basically three types of frameworks created by Selenium WebDriver to automate manual test cases

  • Data-driven Framework
  • Keyword-Driven Framework
  • Hybrid Driven Framework

Become an Selenium Certified Expert in 35Hours

Data Driven Test Framework

A structure based on data in Selenium is the technique of separating the “data set” from the actual “test case” (code). This structure depends completely on the input test data. The test data is fed from external sources, such as an Excel file, a .CSV file or any database. As the test case is separated from the data set, we can easily modify the test case for a specific functionality without making changes to the code.

For example, if you want to modify the code for the login functionality, you can modify only this instead of also modifying any other dependent part of the same code. In addition, you can also easily control how much data should be tested. You can easily increase the number of test parameters by adding more username and password fields to the Excel file (or other sources). For example, if I have to check the login on a web page, then I can keep the user name set and password credentials in an Excel file and pass the credentials to the code to run the automation on the browser in a Java class file independent.

Keyword Driven Test Framework

Keywords are essentially blocks or functions that are named so that they can be consumed for certain functionality. On a simpler level, the keyword receives parameters and generates some output. Keywords are written to abstract the complexity of writing code repeatedly. Think of keywords such as the APIs that serve you (or your application) when you call. In one of the frameworks I designed for a large company, the was a Classes file with a list of Java methods with defined inputs and outputs.

There is a very fine line between keywords and modules. We have heard the term “modularization” or “modular structure” and so on and there is an intersection of spaces here. Therefore, keywords or modules would be practically the same on this site. In the Ruby world, we can implement this type of structure by defining modules and mixing them in strategic places.

When we enter the discussion of frameworks, we will see that the modules are crucial pieces to roast in the framework. It is not exactly similar, but a module in Ruby is very close to an abstract class in Java, however, there are differences as well. However, keywords/modules can become complicated also based on data structures and layers in their test automation structure

Get Selenium 100% Practical Training

Hybrid Driven Framework

A combination of data-oriented and keyword-oriented structures (or oriented by modulation) is commonly considered a hybrid-oriented structure. In general, a structure based on Hybrid Driven is a collection of two or more structures that can be customized and accessed by any user.

For example, a combination of PageObjects, a keyword-oriented structure, a data-based structure, a repository of objects and report listeners provides a powerful hybrid structure. This framework is very basic and very easy to understand. This implements the technique of page object model, data technique, Modular Driven Technique, Log4j Logging, TestNG Reporting and TestNG Reporter Logs.