Loading...

Selenium Framework

by GangBoard Admin, November 20, 2018

Selenium Framework

Selenium framework is a set of code structure which is used in automation testing. In an automation testing we use tools to convert test data into test scripts. To optimize the code structure for automation testing we use Selenium Framework. This framework is used to make the readability of the code simpler so that it becomes more user friendly. It’s like decoding where you break your large code into smaller, readable codes where every code is assigned a particular function.

Why it is Needed?

There are many benefits of breaking a huge code into multiple small codes. It results in:

  • Improved Readability
  • Makes error detection and rectification easy
  • Higher Portability
  • Script Maintenance is reduced
  • Recovery becomes easy in case of losses
  • Reusability of code

There are many frameworks which perform the above actions. But there are 3 most commonly used Selenium Frameworks. They can be classified as:

  • Data Driven Framework
  • Keyword Driven Framework
  • Hybrid Driven Framework

Going into the details, we will take all these 3 into consideration one by one.

Data Driven Framework

Suppose there are many data sets that need to be tested now running the same test over and over in different data sets is time-consuming and prone to errors. For making the task easy we can just separate the data set where we need to apply a particular test from the actual code. In this way, we can save a lot of time. So, if we want to separate a particular ”data set” from the actual code, Data driven framework is used. Here a ”test data set” is created in the excel sheet, and then imported into automation testing tools. The framework depends on the input test data which is fed from external sources like an excel file or any other database. Now when the data set is separated from the actual code it becomes very easy to modify the data set without touching the actual code and vice versa. Or we can say this framework stores ”test data” that needs to be tested in a tabular or spreadsheet format. This way it becomes easy for Test Engineers to apply a single test for all the available test data in the table.

Let’s take an example to get a clearer picture. Suppose, we want to test something with many input fields and with 100 different datasets. Options we have,

  • Creating 100 scripts in total one for each dataset available.
  • Change the value in the test script every time we need to run a test.
  • Input the data from excel sheet, using test data one by one from excel rows we can execute the whole script.
  • Here, we know only the third method seems to be logical and this is what we basically do in Data-Driven Approach.

Suppose, by testing ”login feature”, here we need to give different input combinations: Username and Password. We need to pass the parameters using excel sheets so we need a data-driven framework.

FEW ADVANTAGES:

  • The same test can be used several times.
  • Changes in the test script have no impact on test data.
  • Increases maintainability and flexibility.
  • To create an individual test for each data set is a troublesome and lengthy task. Data-driven framework resolves this issue and works very effectively with the testing process.

Keyword Driven Framework

It is quite similar to Data Driven Framework as here also the operations to be performed are stored in Excel sheet separately or any other external file. All the operations/methods to be performed are kept separately from the actual test script. Or, we can say here we can write the keywords in some external file like Excel and after calling this file with the help of codes different test cases are executed. Here, it is very easy to test the functionalities. It can be called as an extension to Data Driven Framework as it not only separates the test data from the actual code but also keeps the certain set of codes belonging to actual script. Because the keywords are stored in a tabular structure it is also sometimes be known as ”Table Driven Framework”. Here, the main advantage is a single keyword can be used for multiple test scripts.

Hybrid Driven Framework

We can say it is a combination of Data Driven and Keyword Driven Framework. Sometimes there is a need to club 2 or more frameworks. This framework hence uses almost everything in it like different keywords, data-driven approach, pom design pattern etc. So, we can say here the list of inputs (as in the data-driven) and instructions (used in the keyword driven) are combined. Here also the data is provided from some external source and the same script can be used for different data sets as in case of data-driven framework.

 

Related Post

No Comments


    Leave a Reply

    Your email address will not be published Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

    *

    Online Training Quick Enquiry






    Get Free Online training

    Looking for Online Training