Peakin

Selenium is the big player in the open source automation testing suite. Even google, Netflix, Fitbit are using Selenium for testing. 

The Selenium framework consists of automation testing tools bundled into a suite, that can run tests directly on the browser and automatically rerun without manual input. 

Selenium IDE (Integrated Development Environment), Selenium Grid, Selenium WebDriver are parts of selenium. 

What exactly is a framework?

In layman terms, Framework is a set of guidelines or best practices, that are to be done in a systematic manner. Main advantage of using a framework is for readability and reusability.

With the framework in place, you can read data progressively, even if the data changes every time, we access the application. 

What is an automation framework?

It is a platform which consists of various hardware, software, web service automation framework and automation testing tools. The platform is developed based on a set of assumptions that helps in reliable analysis of issues and bugs in the system or application that is being tested. 

Why to use an automation framework?

  • Reusability of components
  • Improves efficiency 
  • Structured process 
  • Increases the test coverage
  • Easy maintenance
  • Reduced dependency on individual testing cases
  • Root-cause analysis and bug detection is easier
  • Test cases are not stopped when one test case fails
  • Test strategy and scope changes dynamically based on the scenario
  • Uninterrupted testing process with minimal manual help

Advantages of Selenium Framework for Automation Testing:

  1.     Opensource: Selenium is open source. There is no cost or license involved for using selenium. Anybody can download and use it. 
  2.     Flexibility: Selenium supports multiple programming languages, including Java, Java script, Ruby, C#, .Net, PHP, Python and Perl. 
  3.     Usability: Selenium is open source hence extensions of the tools can be made easily as per needs
  4.     Framework Support: Wide range of frameworks like Maven, Junit, TestNG and CI/CD tools like Jenkins, making it easier to automate the testing & deployment process.
  5.     Variety: With the suite of tools that selenium has, almost all the testing scenarios are covered with Selenium.
  6.     Reusability: Selenium is cross browser compatible. So, testing in different environments with multiple scenarios is easy with selenium.
  7.     Support: Selenium not only supports different browsers like chrome, edge, Firefox, opera, Internet explorer, Safari and it supports different operating systems such as Mac, Windows & Linux.
  8.  User-friendly: Selenium is user-friendly and has options to recreate user input in real time scenarios, making automation even easier.

Types of Selenium Framework:

The five main types of selenium framework are linear scripting framework, modular testing framework, behavior driven development testing framework, data-driven framework, keyword driven testing framework and hybrid driven testing framework.

Linear scripting framework: 

In a linear scripting framework, the test automation is carried out by running pre-written test cases/steps in sequential order. It is also known as a record and playback framework as testers record the sequence of steps and run them again to catch the issues/defects. 

 

Advantages: 

  • No complex coding is involved. 
  • Test scripts are generated easily & fast
  • Workflow is simple to understand

 

Disadvantages:

  • No error handling
  • Not reusable
  • Not scalable & maintenance is hard

 

 

Modular testing framework:

 

As the name suggests in the modular testing framework, the application under test is divided into smaller modules based on functionality. Testers then code test cases for each module and run them separately. In this framework, there can be a master test script, which is a combination of module-based test scripts, linked in an orderly manner. It is based on OOPs concept abstraction. Change in one module will not affect other modules under test. 

 

Advantages:

  • Easy to maintain
  • Cost-efficient
  • Highly scalable framework
  • Fixing test scripts is easier as it is based on modules

 

Disadvantages:

  • Data is included in test script itself, hence hard to use for multiple data sets
  • Coding knowledge is required

Data-driven framework: 

 

In a linear and modular testing framework, the data is hard coded to the test scripts. It is a major drawback, when there is a need to test the application with varying data. That is when, data-driven framework comes into picture. Here the data is stored separately in an external database, which can be as simple as an excel spreadsheets or text files. From the external database, the data is sent into the test scripts. So, simply put, in a data-driven framework the test logic and data are stored separately.

 

Advantages:

  • Tests can be done with varying data sets. 
  • Multiple scenarios can be tested easily 
  • Test execution is faster

 

Disadvantages:

  • Designing the framework requires highly skilled tester
  • Designing the framework takes a lot of time

 

 

Keyword-driven framework: 

Keyword-driven framework is the extension of data-driven framework. Here along with the data, keywords are stored externally in a tabular format. Hence this is also known as table driven framework. This framework is application independent. Test function to be used is determined based on the keywords. 

 

Advantages:

  • Minimal scripting knowledge
  • Test scripts are independent, irrespective of the application
  • Reusable code

 

Disadvantages:

  • Initial cost is high
  • Time consuming to setup the framework
  • Maintenance is high to build keyword repositories

 

Hybrid test automation framework:

Hybrid testing framework is the combination of above frameworks, based on the requirement. It is best suited for the agile environment. It is a flexible framework, designed to get best test results. 

 

Advantages:

  • Best test coverage
  • Leveraging best of testing framework methods

 

Disadvantages:

  • Complex to set up 
  • Involves additional cost

 

 

Behavior-driven Development testing framework:

Behavior-driven Development testing framework are user friendly. These frameworks don’t require end users to know programming and the end users being business analysts, testers, developers. They help in automation of functional validations. They are in understandable and readable format. It fills the gap between the team members working on the Project.

Out of above frameworks, keyword driven, data driven, and hybrid testing frameworks are widely used with selenium.

Steps involved in test automation:

  1. Based on application estimate the need for automation
  2. Understand the goals for the test automation
  3. Define detailed steps involved in automation testing
  4. Based on above, choose the automation testing tool & framework
  5. Design the test cases
  6. Gather various test data that are to be used 
  7. Create the automated tests and execute them
  8. Continuously run the tests on varying data and make changes as and when required.

 

Verdict:

Understanding the underlying concept of framework, selecting the right framework, effectively implementing and executing it will determine your success in automation testing.