Database testing: Testing done on the retrieved data by the application is called Database testing. In the database testing, we match the data, displayed to the user, with the data stored in the database.
Following factors to be kept in mind for database testing: 1. In the application, data is moved from the database to the front end and from the front end to the database. While the data is constantly moving, tester need to verify whether the database is still mapped or not or whether the correct data is displayed to the user (front end).
2. When a certain action is performed on the front end then the tester need to verify that the corresponding database should also get updated.
3. Whenever an action is performed, database should satisfy the ACID property (Atomicity, Consistency, Isolation, Durability). a. Atomicity : During the transaction, if a single part of the transaction fails then it is considered that the whole transaction fails. b.Consistency : After the transaction, the database should be consistent which means that the data displayed to the client will match with the data in the database. c. Isolation : The transaction can be done in two ways:- one, when multiple transaction are executed all at once and second, when single transaction is done at one time and then followed by other transactions. Result of the transaction should be same in both the cases. d. Durability : When the transaction is done and saved then no external factor can change the result in the database.
4. When transaction is done then the tester should verify the presence of the updated data in all the screens and forms of the application. The updated value should not be displayed on one screen and the older value on other screens. Write the testcases to check the updated value in all the relevant places.
5. For more complex applications, tester should have some knowledge of SQL queries to test the data in the database.
Usually SQL queries are used to test the database. Commonly used command is "Select". For example: select * from <tablename>, which will fetch all the data from the table name mentioned in the query.
Following areas that need to be test during database testing: 1. When transaction is done then the tester should test whether all the transactions should satisfy the ACID properties. Rollback is the command to ensures that the database is consistent. After the transactions are executed then execute the "select" command to check whether the changes are reflected or not.
"select * from <tablename>"
2. Tester should verify the structure of the table in the database.
"DESC <tablename>". This will display the structure of the table.
3. Tester should verify all the field constraints. Tester can do this manually by inserting some values in the fields and check if it results in an error or not.