To maintain integrity and consistency in data it is crucial to utilize Database testing. The following components need to be taken care of while creating test cases for database testing:
- Prepare test environment
- Run a test
- Validate the actual result with that of the expected result
- Report any deviations
Note: As a prerequisite, the user must have abundant knowledge of database servers and structured query language.
Database testing varies from User Interface testing concerning the below parameters:
DB testing involves the schema, Database tables, Columns, Keys and indexes, Stored procedures triggers, DB server validation, validating data duplication.
To Write Test Cases For Database Testing
- Check table presence in the database schema. (Use the select query to display tables)
- Check table naming convention (Use the select query to display tables)
- Check the number of columns in a table (Use select count(*) statement)
- Check column names in a table (select column name from schema where table)
- Check data type of columns in the table (select column_name, data_type from schema where table)
- Check the size of the columns in a table (select column_name, column_type from schema where table)
- Check null fields in a table (select column_name, is_nullable from schema where table)
- Check column keys in a table (select column_name, column_key from schema where table)
Now compare the expected result with the Actual result and report the deviation (if any).