Overview of Database Testing

Posted By : Kunal Sharma | 31-Dec-2017

As the number of internet users are increasing day by day, the data creation, storage and retrieval is also booming to next level and so are the issues increasing because of these things. The main reason for this failure is the less amount of attention/ care given to testing of database.

 

What is Database and how to test it?

 

Database is nothing but a storage structure where the data is organized in the form of columns and rows. It is a repository which is systematically framed which is easy to update and retrieve information or data. 

Database Testing is the process in which we test the SQL queries, database functions, triggers and hence validate the database tables, data models and schema files according to the information provided.

It is the most common misconception about testing that it is the process of validating the information which is limited to front-end only whereas testing is also a process which involves validating every bit of data that is entered by the end user at the back-end or database. 

Even though testing of UI and database are performed at the same time and they go hand in hand, they have different testing procedures.

 


What is the need for testing database?

 

AS we all know that there are tremendous number of user activities which happens every second over the web, a lot of data is generated through web browsing, filling of registration forms, marking attendance, e-commerce, online shopping, etc. Database testing ensure that the data is consistent, integrated and secured. Following are the methods which are used to check data validation:


1. Data Mapping: As we know that data is sent to the server from client side to retrieve, store or update information and then the data is sent back from server to the client side to acknowledge the response, so some things should be kept in mind while validating this:

i. Mapping of data by the user at front end or UI is correct with respect to the data stored in the database tables.
ii. If the user has updated data from UI, database should also get updated immediately with the same data.


2. ACID Properties Validation: ACID properties are the properties of database which are Atomicity, Consistency, Isolation and Durability. These properties should be validated as they help to maintain stability, steadiness and protection of the data which makes it more stable and easy to handle.

i. Atomicity: Atomicity is typically referred to as "All or Nothing" rule as in database a transaction can either Pass or Fail but there cannot be any state where the data is partially updated.
ii. Consistency: Whenever any data transaction is done at UI, it should always have a valid entry in database
iii. Isolation: If multiple transactions are done on the database simultaneously, the state of the database should not get changed and it should remain consistent.
iv. Durability: Once a transaction is successful, then the data should not get impacted with external factors like power failure or system crash


3. Data Integrity: User interface should always show the latest information whenever the data is modified by any CRUD operation. Test cases in database testing should be written in such a way that they should validate the consistency of data on each and every screen. 


4. Business Rule Conformance: There can be some complicated components like constraints, triggers etc which are basically referred as complex database. A QA who is assigned the role of testing the database should possess strong skills in SQL queries so that such complex components could also be tested and validated.

 

How Database testing is performed?

 

The most crucial part while testing the database is to know how to start with the testing process. Following are the steps which are involved in testing the database:

1. Preparing the Test Environment: The first step would be to prepare a test environment where the tester can perform tests. This environment should can be replica of the live database or should be a stand-alone database so that real results can be seen and genuine changes can be added to the database code after the testing is completed.

2. Running the Test: There should be both positive and negative test cases for every operation on the database for validating the CRUD operations on the application. After performing these operation, changes should be visible both on the backend and frontend. There can be many stored procedures which may include many blocks and functions, so they should also be tested individually.

3. Verifying the Test Results: It is nothing but looking into the results of SQL queries which we have hit on the database.

4. Validate: In this step, we validate whether the correct tables or columns are populated on hitting the SQL queries or not.

5. Reporting the Findings: Actual and Expected results are shared with the project manager or business analyst and bugs are reported if there are some differences between the actual and expected result.

 

Thanks!

Related Tags

About Author

Author Image
Kunal Sharma

Kunal is a bright QA Engineer with skills in Manual and Automation Testing.

Request for Proposal

Name is required

Comment is required

Sending message..