QA Tutorials

Database Testing

Every software very application is associated to the database. The database is maintained using a DBMS like MySQL, Oracle or any other DBMS to store all its data. Selenium Web Driver is used for testing web applications and operations are performed like submitting information, retrieving data and validating them. When there is a need of getting data from the database in selenium scripts, we may use API’s which help to interact with database like JDBC.

Database Testing:

Database is used for a long period data storage, standard and organised way of storing process. Parts of database are data and schema. 

What is data?

Data is information of an entity. Data is stored in table format as rows and columns. Eg: Here we can see the organized structure of data in the form of table ‘Customers’ in MySQL.

What is Schema?

Schema contains tables, columns, views, functions, triggers and stored procedures.

How to test the Schema?

We can test schema by selecting design in tables. The name of every column or field should be appropriate neither too short or neither too long and all the data should match the data type. Check if the primary key is unique.

How to test a view?

View is a section of data from a table. The below is a view which shows the order of the customers which can be tested by opening the view design. The name of the view is orderedProducts.

The design of view shows the products ordered by the customers with the help of information produced by two tables ‘Products’ and ‘Orderdetails’

The join in the query above shows the intersection of ‘Products’ table and ‘Orderdetails’ table and finds those products which are present in ‘Orderdetails’ table. When it is executed the result displayed as

For database testing we have to write queries. To test view we have to write a new query, use Select statement check.

Now check stored procedures

We have a name called  deletecustomer stored procedures.

Insert a customer details in the table using Insert query

Test the ‘deletecustomer’ stored procedure by providing the query of delete. Provide the customer id as 4, then execute the statement, the customer id 4 is deleted. Then check the table data using select statement.

Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Back to top button
Close
Close