Selenium: Frameworks

In previous posts, we learnt about all the selenium basics for automation script writing. Now, let's move forward with some advance selenium topics such as Framework

Framework is nothing but set of some predefined protocols and guidelines that how the things will work when we are writing automation scripts. Framework is like 'Single Standard' which is every automation tester is obliged to follow. Basically, framework helps to separate our 'code' and 'data' which will help in achieving higher code readability, reusability and portability. With the help of frameworks, we can test our script with multiple set of data which paves way for very efficient functional testing.  

The main advantage of using frameworks is project maintenance as we can easily manage all our automation scripts, test data and all other related stuffs. e.g. different testers work on different modules of the AUT(Application Under Test)  and with the help of frameworks, we can easily achieve uniformity and there can be no confusion or complexity.

There are various types of frameworks available which helps in automation testing.
  1. Module Based Automation Framework
  2. Library Architecture Automation Framework
  3. Data Driven Automation Framework
  4. Keyword Driven Automation Framework
  5. Hybrid Automation Framework
  6. Test Driven Development (TDD)  
  7. Behavior Driven Development (BDD)

[source: www.evoketechnologies.com ]


In which, module based and library architecture are almost obsolete now and rarely used.

  • Data Driven Automation Framework: 
In data driven automation framework, of course the focus is on data which we are using in our automation scripts. Here, we place our test data in some external files as .xls, .csv or JSON. The advantage is we can easily maintain both code and data. We can test our script with large number of data sets. There are various external jars available to read these data from external sources. e.g Apache POI is popularly used such external jars. In TestNG framework, we can use DataProvider class to read data.

  • Keyword Driven Automation Framework:
In keyword driven automation framework, the focus is to make automation script simple and easy to understand. We use some keywords to write some repetitive functionalities. e.g if we use login scenario, if we have defined 'Login' button as 'loginbtn' and we have used it in 10 different scripts. now, if we want to change its name to 'submitbtn' , we need to change it in all the 10 different scripts but if we use keywords and defined it in one external excel like file, we need to change it's name only in that external file.

  • Hybrid Automation Framework:
This framework leverages advantages of both data driven as well as keyword driven automation frameworks. Here, we put our data in external file as well as we define some keywords that can be used in automation scripts.

  • Test Driven Development (TDD):
This approach is relatively new when compared to above frameworks. Here, when the new requirements come from the clients or business analysts, we prepare automation test scripts according to that requirements and later development begins. At first, all the scripts will fail as there is no actual development of the application but at later stages, the goal is to pass all the test scripts to ensure utmost quality and it is scalable approach. We follow same procedure till the end.

  • Behavior Driven Development (BDD):
In recent times, this is the mostly followed and used automation framework. It includes all the stake holders of the project. Generally, clients and business analysts are non-technical guys. They do not understand the code and scripts. BDD acts as a bridge between these guys and developers, testers. We can define particular functionalities in English like language which is understandable by all together with our code. Cucumber, Jbehave are some very popular BDD frameworks where we can define our scenarios in feature files in plain text using gherkin language. 


We can use any of the above frameworks according to our projects needs and requirements !




Comments

More posts on selenium...

Selenium/Java-OOPs-Encapsulation

Selenium/Java-OOPs-Abstraction

Selenium: Automate Web Application Login

Selenium/Java- CoC

Selenium/Java-OOPs-Inheritance

Selenium: Waits

Selenium: All about XPath Locator in WebDriver

Selenium: Capturing the screenshot

Selenium: BDD- The Disruptive Framework