Database testing
Prepared by
Sujaritha M
Database testing mainly focus on:
Data integrity test
Stored procedures test
Type test
Data size test
Event Driven item test
Input item verification
Data integrity test
Once a value undergoes any of the below
actions
(Update, Delete, Insert)
The Db should be verified for the changes
performed on related entities (ie) foreign
key, primary key and all dependent entities.
Stored procedures test
Every stored procedure is to be tested
separately for its functionality
(Based on separate functions it performs)
Stored procedure need to be broken up into
action items based on functions & then each
action item needs to be tested separately as the
result of complete stored procedure.
conti ….
Execution may differ from the results
obtained by partial execution.
This also helps in validating the modularity
of code (White box)
What is needed for Stored
procedure test ?
The number of arguments being passed.
The data type of each of the arguments
being passed
The order of arguments being passed
The return value
The data type of the return value
What you will do from this ?
Based on these we can categories to write
both positive and negative test cases
Example:
Consider a stored procedure taking 2 data
as input and returning that with the sum
of two data’s
Type Test
This test is performed to verify that the
data types used by the DBA are same as
expected by agreed upon by the
developer
Often the data types chosen by developers
are not the same as suggested by the
DBA, especially for the fields like
Ph (text / Number)
Description ( large text)
Data size test
Performance of Data size testing is often
done only at the front end during the unit
testing, but it is essential to perform it at
back end separately.
This ensures smooth transition while
appending functionality and integrating
modules as during these phases
The data is passed to this system with
direct user interaction and bypassing front
end validation
Event driven item test
Event driven actions like Triggers or
scheduled actions need to be tested on 2
parameters
1. Events that trigger these actions –
Here QA needs to check the events on
which any of the trigger can get fired /
executed. This testing can be done
with the help of DBA also.
conti……
2. Actions performed by the previously
mentioned events. Here the contents of
such stored procedures or scheduled
actions are verified for the functionality
Input Item Verification
This is the process of verification of the input
items.
Even though this is not totally a part of database
testing but this has to be performed essentially
during database testing of the web based
applications
Often, it is seen that the input items like Text
box, Rich text box (ideal for content
management systems), Combination box and
Active X controls are tested for validation only at
front end (screen testing)
Conti………
But these are again to be tested with
Junk character values to confirm that
they do not push in such characters
which the databases often misrepresent
or replace with other characters (this
testing can partially be performed during
unit testing also by the developer
Essential elements needed for
database testing
Backend table structure is very important thing.
Need to know about database structure and the
specification of each table like the size of column
and if any primary key
So we can have a database design document
which help us to know the structure the
specification might be given in FRS ( Functional
requirement spec)
cont ……
Database design documents
If the tester has the idea about the table
structure and design then they can check
the performance issues also
Admin user id & password
Build
Any Application Interface – ex -TOAD
cont….
DSN Name
Data source name (DSN)
A data source name (DSN) is a data structure that
contains the information about a specific database that
an Open Database Connectivity ( ODBC ) driver needs in
order to connect to it.
Included in the DSN, which resides either in the registry
or as a separate text file, is information such as the
name, directory and driver of the database, and,
depending on the type of DSN, the ID and password of
the user.
The developer creates a separate DSN for each
database. To connect to a particular database, the
developer specifies its DSN within a program.
What is way of writing test
cases for database testing?
1. Understand the functional requirement
2. Find out the back end tables, joins, cursors,
triggers, stored procedures (SP), input and
output parameters used
3. Write the test case with different input values
for checking all the paths of SP.
4. Writing test cases for database testing is not
Black box testing. It is white box testing.
How to test database procedures &
Triggers ?
Requirements should get from developer
Understand the input and output of the
Procedures / Triggers.
Execute the Procedures & Triggers and
update the results.
What steps does a tester take in
testing stored procedures?
Understand the requirement of SP
Check whether all required indexes, joins,
updates, deletions are correct by comparing with
the tables mentioned in the stored procedures
Ensure that whether the stored procedure
follows the standard format like comments,
updated by etc.
cont….
Check the procedure calling name, calling
parameters and expected responses for
different set of input parameters
Run the procedure thru database client
programs like TOAD or query analyzer
Rerun the procedure with different
parameters and check results against
expected values.
Thank you