Database Testing

Database Testing deals with finding defects in the database component of the application ->
1. Triggers
2. Stored Procedures.
3. Data integrity test
4. Data type and size validity

Data is an important asset of an application. Data needs to be handled, stored and processed correctly. So, any error at database can cause application malfunctioning. Database testing can be done independently for database components or in conjunction with the front end application.

Database testing is important for following reasons->
1. Data is an important asset.
2. Application flow is controlled by the data values.
3. Integration tests do not consider database as a focused unit and would not able to discover serious errors at the database level.
4. Ultimately, application is supposed to generate correct data.

How is database testing done?
Types of tests are performed in database testing->
1. Unit Testing-> Stored procedure can be stored as an independent unit like a java or c++ class.
2. Black box Testing -> Test cases to consider number of arguments,data types, sequence,return value and its data type, error handling for a stored procedure.
3. White box testing-> Review the code and using white box techniques for a stored procedure.
4. Data type test-> DBA suggested data types to be agreed by developers. Since, front end languages have different data types as compared to databases, choosing a correct data type from front end language would ensure correct functioning of application without any data loss or truncation of data.
This is important from the migration point of view, if later, the application needs to be migrated to another database without loss of any data.
5. Data integrity and consistency-> It ensures data is complete and consistent at all starting with creation. Any action that modifies the data, like update, insert, delete and crate, needs to be checked for data integrity. Integrity is expressed in the form of various constraints like foreign key, primary key, uniqueness etc. This needs to be verified.
6. Support for internationalization -> In case of internationalization, verify if the database support character sets for the desired locale, data is getting stored and is retrieved in the correct fashion.
7. Data verification -> When data from one database is migrated to another, one needs to check values of records, number of columns etc and make sure that here is not data loss.

DbUnit is a tool which can be used for unit testing of database. It is an extension of JUnit.

What is migration testing?
Data migration testing is another testing type testing related to data. During application re-engineering , the data from legacy application is migrated into the new application. Data migration testing deals with checking the correctness and completeness of migrated data.


Post a Comment