I have just joined as a Junior QA and am learning how to test web apps. However, I have stumbled onto the point where I am not aware of the database testing.

  • What are some tools that are under use for database testing?
  • How to test database as a manual tester?
  • How to test database with respect to specific database (e.g. Mysql, MS-SQL, MongoDB)?

I'd appreciate the answers from both manual and automation tester perspective.

  • It really depends what application you're testing and what things you want to verify. You will expect different checks for simple store/read application, different when testing data migration or verifying differences between prod and staging DBs.
    – dzieciou
    Mar 4 '15 at 9:59

Database can be tested various ways, If we are using SQL server then open the SQL query analyzer and write the queries to retrieve the data. Then verify whether the expected result is correct or not. IF not the data is not inserted into database.

We can play with queries to insert, update and delete the data from the data base and check in the front end of the application.

The general test process for DB testing is not very different from any other application. The following are the steps:

Step #1) Prepare the environment

Step #2) Run a test

Step #3) Check test result

Step #4) Validate according to the expected results

Step #5) Report the findings to the respective stakeholders

Usually SQL queries are used to develop the tests. The most commonly used command is the “Select”.

Select * from tablename where condition

Apart from select, SQL has 3 important types of commands:

DDL : Data definition language

DML: Data manipulation language

DCL: data control language

Let us see the syntax for the most commonly used statements.

Data Definition language: Uses CREATE, ALTER, RENAME, DROP and TRUNCATE to handle tables (and indexes).

Create table: Create table (field1 datatype(field size) ,……………..fieldn datatype(field size))

Data Manipulation language: Includes statements to add, update and delete records.

To insert a row into a DB: INSERT INTO (field1, field2, field3) VALUES (‘val1′, ‘val2’…’valn’);

Data control language: Deals with giving the authorization to users for manipulation and access to the data. Grant and Revoke are the two statements used.


As a Manual tester you can test database using commands given by @ashu in answser.

For automation database testing you will need to write script , Tools are given below :

1 - Selenium web driver [For Database functionality testing.]

2 - Jmeter [For Load testing on database]

If you want to do accurate testing then You must get first knowledge of database tables , structure from your DBA OR Developer. Once you get familiar with database which you are going to test , then you will be able to test it in more detail.


For DB testing, you would want to test a scenario and see if they are populated in relevant tables with the right values. For this to be done, you should have strong SQL skills (to INSERT, UPDATE, CREATE, SELECT etc..)

Next, get the DB environment ready, generally clean DB with just the test data values.

Perform the test (say signup)

Check in DB that the signup parameters have been stored in relevant tables with right values as per the input.

Now, if there are deviations fro expected result, you might have to clean the DB and then perform the test again. This will be the best so that all the test values are as per the guidelines and that no "bad data" are there in DB during test.

Tools: I used custom tools created in python to fetch values from various tables. I think any SQL tool should work. MySQL workbench / Oracle SQL developer / PLSQL developer etc.


While many of these answers suggest doing direct DB querying, I'd advise against it besides read-only checks to verify things happened the way you expected them to.

Direct creation, inserts, whatever, should be very extreme edge cases - no one should be writing such queries, and ideally there should be some API or DAO layer that the application and/or devs are using.

You could use the database to guide your thought process though when designing test cases. For example, you're testing the user creation portion - verifying the standard CRUD operations happen in both the UI and the DB for the username, password, profile data, etc would be valuable.


You can go through the following link. It has few points, checklists and some resources on database testing.

Not the answer you're looking for? Browse other questions tagged or ask your own question.