Data driven testing

Data-driven testing approach in test automation

Data-driven testing is the type of testing where test scenarios are designed in a way that they can be executed with different sets of input data. Instead of hardcoding the test cases with specific values, data-driven testing separates the test logic from the test data, allowing the same test to be executed with multiple sets of input data.

Suppose you are testing the login functionality of a web application, and you want to test it using data-driven testing. Now instead of testing the login functionality with different usernames and passwords separately, You can make a list of various combinations of usernames and passwords and then execute it to ensure that the login system works correctly with various inputs.

When this program is executed, It will follow all the mentioned instructions and test different scenarios without needing a new set of instructions for each one.


Benefits of data-driven testing in test automation:

  • You can use data repositories to iterate your test cases and save time as you create a test case only once and execute it using several datasets at any given time.
  • Using data from the repositories, you get better test coverage, as you can test all possible scenarios without making any changes to the test cases.
  • You can store large amounts of data in the repositories and map the data to your test case as required. A Data repository minimizes human error and prevents duplicate data entry in a test case, as you need not enter data manually.
  •  In the Data-driven test automation framework, input data can be backed up in a single or several data sources such as xls, XML, csv, and databases.


How Opkey supports Data-Driven testing

Opkey supports data-driven testing and has built-in data repositories. These repositories can store input data from various resources such as:-

  • CSV (Comma-Separated Values): Test data is stored in plain text files where values are separated by commas. CSV files are easy to create and edit using spreadsheet software.
  • Excel Spreadsheets: Microsoft Excel files are commonly used for storing test data. Each sheet or workbook can represent a different set of test data.
  • Databases: Connecting to databases is a common practice in data-driven testing. You can store your test data in a database, and your automation script can query the database to fetch the required data during test execution.


There are two types of data repositories in Opkey that are used to store and manage the input data that drives the test scenarios. 

1. Global data repository

 

A global data repository is a database where important information is stored in one place, making it easily accessible to different parts of a company or system. Y the ou can reuse data from the global data repository to iterate different test cases. It offers the sharing of data across multiple test cases. Global data repositories are utilized to iterate in the entire test case with different data sets.


Let's understand its use with an example -


When a new product is added to an e-commerce website. All the information about the product 

(Name, Price, Description) is stored in a central product database. This central product database acts as a global data repository for product-related data. Whenever a user browses the website and clicks on a product, the website fetches the product details from the Product Database.  


To learn how to create Global Data Repositories click Here.



2. Local data repository


A local data repository is used for a specific test case. It is a storage area that is specific to a particular part of a system.  It allows you to test specific steps with multiple sets of data. These repositories are utilized to iterate a test step or set of test steps with multiple data sets.

Let's understand its use by an example,

In a workplace, A team has a shared folder on a network where they keep important documents, presentations, and project files. This shared folder acts as a local data repository for the team, making it easy for team members to access and collaborate on shared resources.


To learn how to create a Local Data Repository click Here.


Auto-Data Generation in Data-Driven Testing


Auto data generation in the context of data-driven testing refers to the automatic creation or generation of test data for use in test scenarios. This feature is particularly useful when a large set of diverse data is required for testing, and manually preparing such data can be time-consuming and error-prone. Auto data generation aims to streamline the testing process by automatically creating varied data sets, often based on predefined rules or parameters.
 

To learn more about Auto-data generation click Here.


Simplify your testing journey with Opkey. Learn more about Opkey features.

Click Here  





Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article