Data Driven Framework Tutorial | Part 1

Data Driven Framework tutorial

 

In testing, we deal with huge data sets. It could be user login data, form data, locator values, etc. It is not feasible to use hardcoded data in test scripts all the time, especially when the test data is huge. Here data driven framework comes to rescue.

Data driven framework is a testing framework that uses external sources to store and manipulate test data. These sources could be excel sheets, databases, etc. Assume we have to validate the registration page for 1000 users, each having different sets of data values. In this scenario, we can store this data in excel or database and then retrieve/ manipulate it using the code.

 

Data driven framework

 

Helper methods are written to manipulate the data from external sources. ReadExcel is one of the class in our data driven framework which contains methods to retrieve data from excel.

In true sense, data driven is an approach/ design pattern (similar to Page Object Model) to implement a framework, for eg. TestNG. However, the term framework will be used throughout the tutorial.

 

Download the ReadExcel class from https://github.com/DhawalGit/ReadExcelUtility.git and start exploring it. No need to understand the code, rather focus on how to use its methods to manipulate data from excel.

Components of Data Driven Framework

 

In this tutorial, we will be working on a live demo website to implement the data driven framework. Our framework will consist of the following components:

  • Java maven project for build management.
  • TestNG as the testing framework.
  • log4j for logging purposes.
  • TestNG Listeners to take appropriate actions based on the status of the test.
  • Extent Report to generate the test execution report.

Apart from these components, we will also implement:

  • Data provider and helper methods to manipulate the excel data.
  • TestBase class which will work as a starting point of execution. This class will be extended by all test classes, and other classes, if applicable. Generic methods will also be created in this class.
  • Generic methods – more on it in upcoming tutorials.

 

Demo Application

 

The demo application to learn the data driven framework is https://parabank.parasoft.com/parabank/index.htm

This is a sample banking application which we can use for training purposes. Feel free to register yourself with some dummy values and log in. Familiarize with the application and understand its flow.

The user created in this demo application resets after a day, so do not panic if you are not able to log in the next day. Just register again and you are good to go. In the next tutorial, we will start by creating the framework.

 

Author: Dhawal Joshi

A post-graduate in MCA, ISTQB & ITIL certified QA with more than 8 years of experience in QA working with a CMMI Level 5 organization as System Analyst. I started my automation journey with HP UFT(formerly known as QTP) and for the past few years, I am using Selenium for automation. I also have experience in Android Application Development, Java, HTML, and VBScript. When I am not working, I like to spend time with my family, cooking and learning new developments in IT.

Leave a Reply

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