When you test database migration, it is important to create a set of SQL queries to validate the data before (source database) and after (destination database) migration. The validation queries can be arranged in a hierarchy and it should cover the designed scope.
For example, to test if all users have been migrated, it is essential to check how many users are in the source database and how many have been migrated. Checking the raw counts of each database will ensure this.
Take a sample data set from the source and compare the data with the destination data in the database. Testing tips:
- Always take the most important dataset and data that have values in all columns
- Verify the data types after the migration
- Check the different time formats/zones, currencies etc.
- Check for data with special characters
- Find data that should not be migrated
- Check for duplicated data after migration
A sample test case can be created as shown below: