What Should We Test in Database?
In the previous blog on Overview of Database Testing, we had discussed the basic concepts like database, database testing, the need for database testing and how to perform database testing. In this blog, we will be diving deep into the world of database testing and throw some light on what we need to test in a database?
Types of Database Testing
As also mentioned earlier in the blog, database testing is not as simple as it seems, rather it is more of an extensive effort which requires a wide variety of testing prospects put together under a single umbrella. Database testing is majorly divided into three types of testing:
- Structural Testing
- Functional Testing
- Non-Functional Testing
Fig. 1: Types of Database Testing
1. Structural Database Testing: As the name itself suggests, structural testing is related to structure/schema of the database. It involves the validation of all the elements available in the data repository that is especially used for data storage and not directly shaped/manipulated by end users. Structural testing is further divided into three sub-types:
- Schema Verification
- Row-Column Synchronization
- Server End Validations
Fig. 2: Types of Structural Database Testing
- Schema Verification: The major reason for this verification is to ensure a correct mapping between the Front-End (User Interface) and Back-End (Database). It also checks for the unmapped rows and columns.
- Row-Column Synchronization: It involves compatibility of data fields at the front end and rows & columns at the back end in terms of field lengths, data types and naming conventions of the database.
- Server End Validations: It involves three basic checks:
- Validation of server configurations as per business needs
- Authorization checks for users
- Maximum number of transactions per user
2. Functional Database Testing: This is one of the most important types of testing which plays a vital role in the success of an application/web page. In database testing, functional testing ensures that the consistency, accuracy and security of data are maintained as per the transactions and operations performed by end users. Below mentioned are few of the checkpoints that must be verified while performing functional database testing:
Data Integrity and Consistency:
- Ensure that mandatory fields should not have null values.
- Ensure that same fields have same names across tables.
- Ensure that data is logically organized.
- Ensure that ACID property is implemented properly.
Data Security:
- Ensure that data is secured from unauthorized access.
- Ensure that sensitive data like passwords, bank details, etc. are properly encrypted.
- Ensure that users are provided permissions as per their roles.
3. Non-Functional Database Testing: It involves the testing of quality characteristics and quantity limits of a single component or the whole system put together. In database testing, it plays a key role in defining the extreme ends of usage limits and performance of a database. Non-Functional database testing is further sub-divided 2 major types:
Fig. 3: Types of Non-Functional Testing
1. Load Testing: For a database, load testing is used to analyze the behavior of database under a specific expected load. It is used to measure the performance of database under normal and peak conditions. Below mentioned are few useful checkpoints that should be kept in mind while doing load testing:
- Response time of most commonly used transaction should be tested at priority.
- Important transactions that fulfill the core objective of application should be included in the test suite.
- One editable and one non-editable transactions should be included as part of the test suite for determining the performance of database at peak traffic.
2. Stress Testing: For a database, stress testing is used to determine the response/outcome of the database when the load is increased beyond operational capacity and often to a break point. It is used to measure the stability, robustness and error handling capability of the database. Below mentioned are some keys points that should be kept in mind while performing stress testing:
- Planning and timing should be given utmost importance to make the process cost effective.
- Test data for stress testing should be covering the most frequently used transactions.
These are the most crucial key points that should be tested in a database for a better performance and integrity. I hope this section of information provides you with an insight about what we should test in a database.
Keep looking this space for the next blog which will help you understand – “How to perform Database testing?”