• Selenium Video Tutorials

Selenium WebDriver - Frameworks



Selenium is an open-source and a portable automated software testing tool for testing web applications. It has capabilities to operate across different browsers, devices and operating systems. Selenium is not just a single tool but a set of tools that helps testers to automate web-based applications more efficiently. Selenium can be used with multiple programming languages like Java, Python, Ruby, JavaScript, C#, and so on.

Selenium Components

The different components of Selenium are listed below −

  • Selenium IDE − Selenium Integrated Development Environment (IDE) is a Firefox plugin that lets testers record their actions as they follow the workflow that they need to test. From Selenium 4, Selenium IDE is also available in Chrome along with parallel execution features and metrics to track pass/fail tests.

  • Selenium RC − Selenium Remote Control (RC) was the flagship testing framework that allowed more than simple browser actions and linear execution. It makes use of the full power of programming languages such as Java, C#, PHP, Python, Ruby and PERL to create more complex tests. It is similar to a server running in tandem with the browser and the tests.

  • Selenium WebDriver is the successor to Selenium RC which sends commands directly to the browser and retrieves results.

  • Selenium Grid is a tool used to run parallel tests across different machines and different browsers simultaneously which results in minimized execution time. Till Selenium 3, jars for hub and node are required to be triggered separately to kick test execution. However, from Selenium 4, both the hub and node jars are combined to a single jar.

What is a Framework?

A framework is a group of standards, assumptions and guidelines for creating test scripts that everyone should adhere to. Every organization or team may use different frameworks but each of them should be guided by a common set of rules.

A framework development is a continuous process and it needs time for development of an exhaustive framework. A framework requires regular updates and maintenance. For example, some libraries may be deprecated, for that we may have to update the libraries, additional libraries may be added in some cases to make the framework more powerful.

Once a dynamic framework has been developed after a period of time, new test scripts can be developed in a very short span of time. Along with that, maintenance also becomes relatively easier.

Types of Frameworks

The different types of frameworks are listed below −

  • Keyword Driven Framework

  • Data Driven Framework

  • Hybrid Driven Framework

Keyword Driven Framework

A keyword testing or a keyword driven framework is a set of guidelines followed while automating test cases, in which the implementation logic and the technical information are hidden. The usage and maintenance of a keyword driven framework is very easy.

A group of keywords in a particular and purposeful order has to be incorporated as a part of test case preparation to perform a particular task or tasks on the application. All these keywords are described in the common repository or a reusable library.

In the keyword driven testing framework, there is a clear partition between the test case and the coding logic of test automation. It has the below usages −

  • A keyword driven framework can be used effectively by anyone without requiring technical expertise. Every member of the team can participate in the testing which helps to ensure a quality product and development of test cases at a faster rate.

  • In case an update is required, the changes are made at the implementation logic and there is no need to rewrite or modify the test cases.

  • In the keyword driven framework, meaningful and consistent keywords are used in the entire test case, thus ensuring uniformity in the test cases.

  • A new test case can be created in the keyword driven framework easily by simply updating, incorporating or changing the order of the keywords.

Data Driven Framework

A data driven framework is the one in which the test cases are segregated from the data set. Also, it gives the provision to run the same test case against multiple sets of data. Since the test code implementation and test data are independent of each other, the data set can be modified without impacting the implementation logic and vice-versa.

In a data driven testing framework, more than one set of data can be run against the same test case, thus the same application can be tested against a wide data range without requiring additional code. Thus code is developed once but reused multiple times.

A data driven testing framework allows multiple execution of test cases without increasing the number of test cases. Sometimes, test data is generated automatically and this allows the application to be tested against a wide range of random data sets. In such a scenario, a data driven testing framework ensures a more robust and quality product.

Hybrid Driven Framework

A hybrid driven framework works in combination of data driven and keyword driven frameworks. Both the test data and keywords(i.e the actions to be performed on the application) are fed from external files.

The external test data source can be any file having extensions with .txt, .properties, .xlsx, .xls, .csv, and also with the help of data providers. The keywords can be from Java class files, excel files, and so on.

A hybrid driven framework helps to make the test cases more flexible and individual features can exist independently without affecting the others. The test cases created with a hybrid framework are easier to maintain and addition of new test cases to this type of framework require less of time.

This concludes our comprehensive take on the tutorial on Selenium Webdriver - Frameworks. We’ve started with describing components of Selenium, what is a framework, types of a framework, and described keyword driven, data driven, and hybrid frameworks.

This equips you with in-depth knowledge of the frameworks in Selenium Webdriver. It is wise to keep practicing what you’ve learned and exploring others relevant to Selenium to deepen your understanding and expand your horizons.

Advertisements