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.
The integrity of a database is checked by assessing different kinds of integrity measures:
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.
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.
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.
There are several reasons which can explain the importance of data integrity testing. A few of those are:
Several different activities are performed to test data integrity. A few of these are listed below: