21
Database Database testing testing Prepared by Prepared by Saurabh sinha Saurabh sinha

Database testing

Embed Size (px)

DESCRIPTION

Database testing. Prepared by Saurabh sinha. 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 - PowerPoint PPT Presentation

Citation preview

Page 1: Database testing

Database testingDatabase testing

Prepared byPrepared by

Saurabh sinhaSaurabh sinha

Page 2: Database testing

Database testing mainly focus Database testing mainly focus on:on:

Data integrity testData integrity test Stored procedures testStored procedures test Type testType test Data size testData size test Event Driven item testEvent Driven item test Input item verificationInput item verification

Page 3: Database testing

Data integrity testData integrity test

Once a value undergoes any of the Once a value undergoes any of the below actions below actions

(Update, Delete, Insert) (Update, Delete, Insert) The Db should be verified for the The Db should be verified for the

changes performed on related entities changes performed on related entities (ie) foreign key, primary key and all (ie) foreign key, primary key and all dependent entities.dependent entities.

Page 4: Database testing

Stored procedures testStored procedures test

Every stored procedure is to be tested Every stored procedure is to be tested separately for its functionalityseparately for its functionality

(Based on separate functions it performs)(Based on separate functions it performs) Stored procedure need to be broken up into Stored procedure need to be broken up into

action items based on functions & then each action items based on functions & then each action item needs to be tested separately as action item needs to be tested separately as the result of complete stored procedure.the result of complete stored procedure.

conti ….conti ….

Page 5: Database testing

Execution may differ from the results Execution may differ from the results obtained by partial execution.obtained by partial execution.

This also helps in validating the This also helps in validating the modularity of code (White box)modularity of code (White box)

Page 6: Database testing

What is needed for Stored What is needed for Stored procedure test ?procedure test ?

The number of arguments being The number of arguments being passed.passed.

The data type of each of the The data type of each of the arguments being passedarguments being passed

The order of arguments being passedThe order of arguments being passed The return valueThe return value The data type of the return valueThe data type of the return value

Page 7: Database testing

What you will do from this ?What you will do from this ?

Based on these we can categories to Based on these we can categories to write both positive and negative test write both positive and negative test casescases

Example:Example: Consider a stored procedure taking 2 Consider a stored procedure taking 2

data as input and returning that with data as input and returning that with the sum of two data’s the sum of two data’s

Page 8: Database testing

Type TestType Test

This test is performed to verify that This test is performed to verify that the data types used by the DBA are the data types used by the DBA are same as expected by agreed upon by same as expected by agreed upon by the developerthe developer

Often the data types chosen by Often the data types chosen by developers are not the same as developers are not the same as suggested by the DBA, especially for suggested by the DBA, especially for the fields likethe fields like Ph (text / Number)Ph (text / Number) Description ( large text) Description ( large text)

Page 9: Database testing

Data size testData size test Performance of Data size testing is Performance of Data size testing is

often done only at the front end during often done only at the front end during the unit testing, but it is essential to the unit testing, but it is essential to perform it at back end separately.perform it at back end separately.

This ensures smooth transition while This ensures smooth transition while appending functionality and appending functionality and integrating modules as during these integrating modules as during these phasesphases

The data is passed to this system with The data is passed to this system with direct user interaction and bypassing direct user interaction and bypassing front end validationfront end validation

Page 10: Database testing

Event driven item testEvent driven item test Event driven actions like Triggers or Event driven actions like Triggers or

scheduled actions need to be tested on scheduled actions need to be tested on 2 parameters2 parameters

1. 1. Events that trigger these actions – Events that trigger these actions – Here QA needs to check the Here QA needs to check the

events on events on which any of the trigger which any of the trigger can get fired / can get fired / executed. This executed. This testing can be done testing can be done with the help with the help of DBA also.of DBA also.

conti……conti……

Page 11: Database testing

2. 2. Actions performed by the Actions performed by the previously previously mentioned events. Here mentioned events. Here the contents of such stored the contents of such stored procedures or scheduled procedures or scheduled actions actions are verified for the functionalityare verified for the functionality

Page 12: Database testing

Input Item VerificationInput Item Verification This is the process of verification of the This is the process of verification of the

input items. input items. Even though this is not totally a part of Even though this is not totally a part of

database testing but this has to be database testing but this has to be performed essentially during database performed essentially during database testing of the web based applicationstesting of the web based applications

Often, it is seen that the input items like Often, it is seen that the input items like Text box, Rich text box (ideal for content Text box, Rich text box (ideal for content management systems), management systems), Combination box box and Active X controls are tested for and Active X controls are tested for validation only at front end (screen validation only at front end (screen testing)testing)

Conti………Conti………

Page 13: Database testing

But these are again to be tested But these are again to be tested with Junk character values to with Junk character values to confirm that they do not push in confirm that they do not push in such characters which the such characters which the databases often misrepresent or databases often misrepresent or replace with other characters (this replace with other characters (this testing can partially be performed testing can partially be performed during unit testing also by the during unit testing also by the developerdeveloper

Page 14: Database testing

Essential elements needed for Essential elements needed for database testingdatabase testing Backend table structure is very important Backend table structure is very important

thing.thing. Need to know about database structure and Need to know about database structure and

the specification of each table like the size the specification of each table like the size of column and if any primary keyof column and if any primary key

So we can have a database design So we can have a database design document which help us to know the document which help us to know the structure the specification might be given in structure the specification might be given in FRS ( Functional requirement spec)FRS ( Functional requirement spec)

cont ……cont ……

Page 15: Database testing

Database design documentsDatabase design documents If the tester has the idea about the If the tester has the idea about the

table structure and design then they table structure and design then they can check the performance issues alsocan check the performance issues also

Admin user id & passwordAdmin user id & password BuildBuild Any Application Interface – ex -TOADAny Application Interface – ex -TOAD

cont….cont….

Page 16: Database testing

DSN NameDSN Name Data source name (DSN) Data source name (DSN) A data source name (DSN) is a data structure that A data source name (DSN) is a data structure that

contains the information about a specific contains the information about a specific database that an Open Database Connectivity database that an Open Database Connectivity ( ODBC ) driver needs in order to connect to it.( ODBC ) driver needs in order to connect to it.

Included in the DSN, which resides either in the Included in the DSN, which resides either in the registry or as a separate text file, is information registry or as a separate text file, is information such as the name, directory and driver of the such as the name, directory and driver of the database, and, depending on the type of DSN, the database, and, depending on the type of DSN, the ID and password of the user.ID and password of the user.

The developer creates a separate DSN for each The developer creates a separate DSN for each database. To connect to a particular database, database. To connect to a particular database, the developer specifies its DSN within a program. the developer specifies its DSN within a program.

Page 17: Database testing

What is way of writing test What is way of writing test cases for database testing?cases for database testing?

1.1. Understand the functional requirement Understand the functional requirement

2.2. Find out the back end tables, joins, Find out the back end tables, joins, cursors, triggers, stored procedures (SP), cursors, triggers, stored procedures (SP), input and output parameters usedinput and output parameters used

3.3. Write the test case with different input Write the test case with different input values for checking all the paths of SP.values for checking all the paths of SP.

4.4. Writing test cases for database testing is Writing test cases for database testing is not Black box testing. It is white box not Black box testing. It is white box testing.testing.

Page 18: Database testing

How to test database How to test database procedures & Triggers ?procedures & Triggers ?

Requirements should get from Requirements should get from developerdeveloper

Understand the input and output of Understand the input and output of the Procedures / Triggers.the Procedures / Triggers.

Execute the Procedures & Triggers Execute the Procedures & Triggers and update the results.and update the results.

Page 19: Database testing

What steps does a tester take What steps does a tester take in testing stored procedures?in testing stored procedures? Understand the requirement of SPUnderstand the requirement of SP Check whether all required indexes, joins, Check whether all required indexes, joins,

updates, deletions are correct by updates, deletions are correct by comparing with the tables mentioned in comparing with the tables mentioned in the stored proceduresthe stored procedures

Ensure that whether the stored procedure Ensure that whether the stored procedure follows the standard format like follows the standard format like comments, updated by etc. comments, updated by etc.

cont….cont….

Page 20: Database testing

Check the procedure calling name, Check the procedure calling name, calling parameters and expected calling parameters and expected responses for different set of input responses for different set of input parametersparameters

Run the procedure thru database Run the procedure thru database client programs like TOAD or query client programs like TOAD or query analyzer analyzer

Rerun the procedure with different Rerun the procedure with different parameters and check results parameters and check results against expected values.against expected values.

Page 21: Database testing

Thank youThank you