Thursday, February 18, 2016

Significance of Database Testing



Database is a valuable asset for each and every company in today’s technology world. It is crucial and acts as the backbone of any software application. Without an appropriate database, we cannot imagine the application systems to function as per user requirements.

Initially the banks were using manual processes to record the different transactions, but the technology help in streamlining their processes.  The software applications are regularly updated to provide better functional benefits and convenience to bank.  What happens if while migrating from one application to another the underlined database is not transferred properly? The transactions will all get messed up and the basic use of technology gets defeated. So we need to test our database for all related attributes. 

The organizations generally utilize different applications having the same database concurrently. These applications need to be upgraded regularly as per latest market requirements. We have to migrate the database carefully between the different applications. It is important to have a good database management system due to high relevance of database and data consistency.
In general, an application development includes programming code, configuration files, CSS Files, JQuery files, third party tools, SQL files, and other external systems.  On the other hand, testing an application means testing each and every part separately and also testing how all these parts communicate within themselves and with external factors. 

Traditionally, the data related testing is done at the GUI/Client Layer or Business Logic Layer. Apart from testing the various codes and attributes, testers would also need to test the vital part in the system-the database.

Database testing is a process of testing the data stored in the database. It requires some in depth knowledge of the given application and a pre-planned approach to test the data. It is essential when application has persistent storage of data, have centralized control over data, control on data redundancy, control on consistency and integrity, includes multiple user support, data sharing practice, data documentation, data autonomy, control over data access and moreover client is concerned for security, backup and recovery of data.

There are many database tools available like MS-Access2010, MS SQL Server 2008 r2, Oracle 10g/11g, Oracle Financial, MySQL, PostgreSQL, DB2 etc. The software applications must be developed using any of the database tools.

The question comes in mind that what we have to test in database testing. The main attributes to be considered in testing are:
  1. Accurate mapping of different screens of application and the relationship of its DB: For all CRUD operations, verify that respective tables and records are updated when user clicks ‘Save’, ‘Update’, ‘Search’ or ‘Delete’ from GUI of the application as per the design documents.
  2. Exhaustive testing of ACID properties of DB Transactions: ACID properties refer to the ‘Atomicity’, ‘Consistency’, ‘Isolation’ and ‘Durability’. Proper testing of these four properties must be done during the DB testing activity. 
  3. Data integrity: Maintaining and assuring the accuracy and consistency of data over its entire life-cycle is a critical aspect to the design, implementation and usage of any system which stores, processes, or retrieves data.
  4. Implementation of Business Rules: The business rules describe the operations, definitions and constraints that apply to an organization and are put in place to help the organization achieve its goals and objectives.
In order to test the DB accurately, a tester should possess good knowledge of SQL and specially DML (Data Manipulation Language) statements. The tester should also acquire understanding of internal DB structure of AUT (Application under Test). Once these pre-requisites are satisfied, then the tester can test the DB with more accurate parameters.  

Database is the engine of any client/server system. What if any malfunctions appear it may cause system deadlock, data corruption, data loss and bad performance. Hence, the importance of database testing in software testing should not be ignored.

Database Testing & its Importance

Database is the most valuable asset for every company because it is the most critical and the backbone of any software applications. Without an appropriate database, the application system will not be able to function as per user requirements. 

There are many organizations/scenarios where many different applications use the same database at the same time and these applications upgrade time to time as per market prerequisites therefore while changing the applications, nobody throws away the database however they migrate it very carefully. Because of such significance of database, it is important to have a good database management. As this could cost a company if any factor destroy the data consistency.

An application development includes programming code, configuration files, CSS Files, JQuery files, third party tools, SQL files, and other external systems.  Testing an application means testing each part separately and testing how all the parts communicate.

Traditionally all the data related testing is done at the GUI/Client Layer or Business Logic Layer. Apart from testing the various codes and attributes, testers would need to test one of the most vital part in a system-the database.

Database testing is a process working with data that's stored in the database. It involves some in depth knowledge of the given application and requires more defined plan of approach to test the data. It is essential when application has persistent storage of data, having centralized control of data, need to control of redundancy, need to control of consistency and integrity, having multiple user support, want sharing of data, data documentation needed, data independence, control of access is required and client has concerns for security, backup and recovery

Database testing, basically, includes the following:-
Ø  Data Accuracy & Validity (Field size validation)
Ø  Data Integrity (Check constraints, insert, delete, update)
Ø  Database Objects (Stored Procedures, Views, Tables)
Ø  Data Migration (Import, Export)
Ø  Data Transaction Consistency and Concurrency (States & Locks)
Ø  Performance related to database (Indices, number of triggers and procedures)
Ø  Security related to database - Data Accessing ( unauthorized access)

There are many database tools  available like MS-Access2010, MS SQL Server 2008 r2, Oracle 10g/11g, Oracle Financial, MySQL, PostgreSQL, DB2 etc. and every software application must be built using any of these database tools.
Database designing is done in three phases: Conceptual Designs -> Logical Design-> Physical Design

When the application is under execution, the end user mainly utilizes the ‘CRUD’ operations facilitated by the Database Tool.
Ø  C: Create – When user ‘Save’ any new transaction, ‘Create’ operation is performed.
Ø  R: Retrieve – When user ‘Search’ or ‘View’ any saved transaction, ‘Retrieve’ operation is performed.
Ø  U: Update – when user ‘Edit’ or ‘Modify’ an existing record, the ‘Update’ operation of DB is performed.
Ø  D: Delete – when user ‘Remove’ any record from the system, ‘Delete’ operation of DB is performed.

Now, the question comes in mind that what to test in database testing:
  1. The mapping between different forms or screens of application and the Relations of its DB is should be accurate and is also according to design documents. For all CRUD operations, verify that respective tables and records are updated when user clicks ‘Save’, ‘Update’, ‘Search’ or ‘Delete’ from GUI of the application.
  2. ACID properties of DB Transactions refer to the ‘Atomicity’, ‘Consistency’, ‘Isolation’ and ‘Durability’. Proper testing of these four properties must be done during the DB testing activity. 
  3. Data integrity refers to maintaining and assuring the accuracy and consistency of data over its entire life-cycle, and is a critical aspect to the design, implementation and usage of any system which stores, processes, or retrieves data.
  4. To Ensure Accuracy of implemented Business Rules.
In order to test the DB properly and accurately, first of all a tester should have very good knowledge of SQL and specially DML (Data Manipulation Language) statements. Secondly, the tester should acquire good understanding of internal DB structure of AUT. If these two pre-requisites are fulfilled, then the tester is ready to test DB with complete confidence. 
A back end is the engine of any client/server system. If the back end malfunctions, it may cause system deadlock, data corruption, data loss and bad performance. 

Hence, the importance of database testing in software testing should not be ignored as it is the data which is visible to the user as it will help the tester identify the root cause of the problem apart from detecting the hidden bugs in the database.  

Golden rules for software testing



Testing is termed as a process of evaluating a system or the sub components with the purpose of understanding whether the system fulfils the requirements or not. It helps identify the gaps, errors, or any missing requirements against the defined requirements. 

Based on my testing experience, I feel that testing is a basic human nature of examining things before accepting or agreeing upon. In case of software testing, it starts with analysing requirements much before actual software development. 

Software testing can be grouped into four major phases:
  • Unit Testing (by developer or a separate white-box testing team)
  • Integration Testing (by Development Team)
  • System Testing (by Professional Testing Team)
  • Acceptance Testing (by Business Users)

The few golden rules of software testing to be considered are:
  • Identifying bugs in the early stages: Ideally, software testing process should start once the testing team gets the requirement specification document from a client or development team. In involves analysing the specified requirement documents prudently, and resolving the questions at the earliest. The issues acknowledged during early stages facilitate the development team to develop the software with correct functionalities.
  • Preparation of Test documents: Once the documents are reviewed, the next step involves planning of test strategies, test scenarios, test cases and respective test data if required.
  • Quality remains the key point: A Tester has to stick to the quality and perform quality testing instead of bugs count, complete test cycles on time and perform software/product quality. During testing, the main focus should be based on client business requirements and expectations.
  • Descriptive Bug report: Whenever tester reports a bug, he/she should provide comprehensive document about the bug occurrence with supportive screenshots. Do suggest the severity and priority of the bug. Do to mention the expected and actual results to guide the development team for the bug resolution process.
  • Include Regression Testing: After a test cycle completion, Development team fixes logged issues in bug management tool and release the software for testing again. With bug verification, always ask the development team for impact analysis report and perform regression testing to make sure that there is no impact of the bug fixation process.
  • Test with Real scenarios and Test data: Negative testing should be done to test robustness of the software, however, make sure that prepared test scenarios and test data is quite real as predictable by client end users.
  • Maintain record of change requests: Once the project is completed one or few releases, usually documentation of change requests is not done by the development team. In this situation, as under change request management, testers should maintain test cases based on the changes with the priority status.
  • Don't fight for bug fixes: Testers need to report all possible bugs in respective bug management tools with the severity and priority of the bug fix. However the bug fixation selection should be decided based on business urgency by the client, business analyst and technical managers. Definitely testers should give inputs to them with the accurate reasons for the necessity of fixing bugs.
  • Bug Leakage analysis: After product release to client and UAT completion, if bugs are raised by client, Tester should do an analysis of bugs and provide inputs on the bug leakage. Also needs to prepare preventive actions for the future quality releases.
  • Focus on the software testing process, not on the tools: There are many free and paid tools available in market for testing and test management to make our tasks easier. However, testers should always focus on core testing processes; the other tools can be used as additional support only.
  • Don’t presume more of automated testing: Automated testing can be beneficial and a time saver, however sometimes it can be expensive and doesn’t provide the required results.

The requirements analysis and accurate testing are the major reasons of software projects delays/ failures. These golden rules would definitely push all testers to hook on to it for the help in testing. Utilising these rules in a testing project will help in delivering quality software products on time.