What is Data Integrity Testing?

The data integrity testing is a process to ensure the said integrity of the data. It verifies that the data stored in a database is what we intended to store and does not change accidentally while accessing it.

The integrity of any data refers to its consistency and accuracy. It corresponds to the reliability and trustworthiness of the data.

Types of data integrity tests

The integrity of a database is checked by assessing different kinds of integrity measures:

  1. Domain integrity: Domain integrity ensures that each value in a column falls within the permissible range of the domain of that column. Moreover, the conditions for default and null values must also be met. For example, a date ahead of the current date in the date of birth column must be invalid.

  2. Entity integrity: Entity integrity ensures that each row of the database has a non-null primary key. This primary key must be unique for each row of the table. This is tested by adding duplicate or null values. For example, the roll number of a student can be the primary key of a table containing a list of students. Every student has a unique roll number. This means that no two students can share the same roll number.

  3. Referential integrity: Referential integrity ensures a valid relationship between two tables by checking the relationship between the foreign key and primary key in those tables.

A foreign key is a column or a set of columns that establish a relationship with another table by referencing to its primary key. The table that contains the primary key is the parent table, and the table that contains the foreign key is the child table.

Why is data integrity testing important?

There are several reasons which can explain the importance of data integrity testing. A few of those are:

  1. It helps to prevent accidental data loss.
  2. It helps to ensure the ACID (Accuracy, Consistency, Integrity, Durability) property of the database.
  3. It helps to ensure synchronization between the front-end and back-end. The changes in the database must reflect on the front-end, and the operations on the front-end must make relevant changes in the database.

How is it tested

Several different activities are performed to test data integrity. A few of these are listed below:

  1. The compatibility of the data is tested for older versions of hardware and software.
  2. One must place the default values if a value is not supplied to any cell.
  3. If a value is supplied, it must be saved successfully and not replaced by null values.
Copyright ©2024 Educative, Inc. All rights reserved