Introduction to Crud Testing:
CRUD testing is a black box testing. CRUD is an acronym for Create, Read, Update, Delete. CRUD testing is another term for database testing. Database forms an inevitable part of a software. Database forms the backbone of any application- web or desktop, data is stored somewhere. A user feeds in the information and the data gets stored in some form. An organisation may use any of the available databases available in the market - MS Access, Oracle, MySQL, DB2 etc. It depends on the needs and requirements of an organisation as to which kind of database has to be integrated with their application. Every database has its own set of features and associated cost with it.
CRUD operations from the perspective of an end-user can thought of like this -
- Create - User 'Saving' any new transaction.
- Read/Retrieve - User 'Searching' or 'Viewing' any transaction.
- Update - When a user wants to 'Edit' or 'Modify' an existing data.
- Delete - When user wants to 'Remove' any data from the system.
Let's take up a very common scenario of any of the social networking application. When a user is new, he registers on the application and the data gets stored in the application server. If in case someone wants to update their information or add new information, they have the required option. Examples can be skype, facebook etc.
Why Database Testing :
- To ensure Data Mapping -The system must be able to track the records correctly. That means, respective values are updated in the tables. For instance person A wants to change his name and phone number that should reflect in appropriate record fields.
- Maintain ACID Properties - ACID properties lie at the core of a database structure. Atomicity, consistency, isolation, durability - these four components are essential and forms a complete package for a robust database. Atomicity means that changes must reflect all across uniformly or none should be affected. Consistency implies that a data must only be updated when it follows some predefined rules. Isolation determines how users are able to view the transactions, that is, isolation rules define how a change made to a certain thing is reflected all across. Durability states the transactions once committed will be saved permanently . For instance, if a booking has been done for a flight, the booking for a seat will remain even if there is some mishap in the system.
- Ensure Data Integrity -Data integrity means when a data is modified, the latest state of data must reflect in every system. A system therefore must show the updated and most recent values to all the users accessing it from anywhere.
- Ensure Accuracy of implemented business Rules -In the current scenario database follow the concept of RDBMs which is relational database management system. Referential integrity refers to the relation that exists among the tables. Primary key contraints, foreign keys, triggers, stored procedures etc form a set of business rules. Therefore developers integrate these business rules into their code when implementing database business logic. These business rules are essential in maintaining the ACID properties.
How to Test Database:
Branch or decision coverage technique aims to test whether a program performs the requisite jump or branching. If the program branches successfully, then the rest of the code within the branch must also execute efficiently.
The diamond shapes are the decision nodes, based on the true and false conditions, the flow of program takes place.
Path Coverage Testing:
- Create own Queries -In order to ful-fill this criteria a tester must be well versed with SQL language and also must understand the logic and structure of the database for the system under test. If these prerequisites are met, then the tester is able to perform CRUD operations from the application's user interface, and using SQL queries they can verify the results.
- Observe Data Table wise -If a tester is not well acquainted with SQL queries then he may carry out database testing with the help of GUI of the application. This process will of course be tedious as the table grows larger.
- Get Query from the Developer -This is the simplest process of conducting database testing. The tester may begin with verifying the GUI and then after getting the code from the developer, tester may run the SQL queries. So This saves the tester from the hassles of understanding the database structure and also remain free from the complexities of running SQL queries.
Crud Testing Infographics:
Database testing ensure security and reliability of an application. We have understood that keeping the privacy of user's data is of prime importance. Therefore it is necessary to carry out database testing to ensure data integrity, consistency etc. are maintained. While performing database testing one must keep in mind the 'why' and 'how' criteria .