Download DataBase Testing

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft Access wikipedia , lookup

IMDb wikipedia , lookup

SQL wikipedia , lookup

Oracle Database wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

PL/SQL wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Ingres (database) wikipedia , lookup

Concurrency control wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Functional Database Model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Database wikipedia , lookup

Relational model wikipedia , lookup

ContactPoint wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
DATABASE TESTING
EIMANTAS ŽLABYS IFM 2/2
OBJECTIVES








What is DB Testing ?
Testing at the Data Access Layer
Need for Testing DB Objects
Common Problems that affect the Application
Should Testers Know Databases
Writing Test Cases to Test Databases
Testing Tools
Examples
WHAT IS DATABASE TESTING
Database Testing includes Testing for Data
Integrity , Data Validity , Data manipulation.
 Database Objects can be tables, views , stored
procedures , indexes etc
 Time taken for Retrieval of Records from the
Database
 Time for Query Execution

LAYERS IN A APPLICATION



Client Layer – Is responsible for the presentation of
data, receiving user events and controlling the user
interface.
Application Layer - Business-objects that implement
the business rules "live" here, and are available to the
client-tier
Data Layer : This tier is responsible for data storage
TESTING SHOULD INCLUDE
Testing the Front End / GUI / Client Layer
 Testing the Business Logic Layer
 Testing the Database

 Reviewing
E/R Diagrams
 Reviewing the Database Designs
 Reviewing the Tables, views , stored procedures etc
WHY TEST DATABASE OBJECTS



Data is stored in the tables
Stored Procedures will handle the Insertion , deletion
& Updation & Retrieval of Information from the
Database
No Testing/Improper testing will result in missing
critical application functionality
GUI VS DATABASE TESTING
Traditionally all the data testing is done at the
GUI Level
 Corruption of data can occur at any layer
 We must present verification of application
correctness as data travels through the system.

PROBLEMS IF DATABASE TESTING IS IGNORED

Data corruption


Occurs due to poor design
Redundant data
Hidden duplicate records (same customer added
twice with different primary keys).


Inconsistent data

Data records added to the same database through multiple applications
can add inconsistent data.
WHAT DO WE TEST AT THE DB LEVEL





Validate the table naming conventions
Validate the column naming conventions
To check if the correct datatype is selected for a
column
To check the consistency in datatypes for columns
common across tables
To ensure the usage of correct field width
WHAT DO WE TEST AT THE DB LEVEL






To ensure consistency in field width for columns
common across tables
Existence of a primary key on a table
Existence of a foreign key on a table
Validity of check constraints
Validity of default constraints
Check for presence of indexes on a column
WHAT DO WE TEST AT THE DB LEVEL





Check for Unique indexes
Existence of non-clustered indexes
Existence of clustered indexes
Note the time of execution of queries
Note the time of compilation of queries
WHAT DO WE TEST AT THE DB LEVEL






Evaluate the query execution plan
Note the time of execution of stored procedures
Note the time of compilation of stored procedures
Evaluate the query execution plan
Denormalize the tables
Normalize the tables
DATABASE TEST TOOLS
SQL Tuner : Embaradero
Eases the complexity of writing high-performance SQL
code by providing built-in help for writing
syntactically correct SQL, and by assisting in every
aspect of complex tuning efforts.
DATABASE TEST TOOLS
Datatect : Banner Software
Generate a variety of realistic test data to RDBMS
including Oracle, Sybase, SQL Server, and
Informix
DB Stress :
Utility for stress testing the server parts of
information systems and applications, as well as
DBMSs and servers themselves.
DATABASE TEST TOOLS


Database Opensource Test Suite
The Database Opensource Test Suite (DOTS) is a
set of test cases designed for the purpose of
stress-testing database server systems in order to
measure database server performance and
reliability.
DATABASE TEST TOOLS


DBMonster
DBMonster is an application to generate random
data for testing SQL database driven applications
under heavy load.
EXAMPLES (1)
[Test]
public void ColumnTypeIsNotDeprecated()
{
const string cmdText = @"SELECT t.name AS tableName,
c.name AS columnName,
ty.name AS columnType
FROM sys.tables t
JOIN sys.columns c ON c.object_id = t.object_id
JOIN sys.types ty ON ty.system_type_id = c.system_type_id
AND ty.user_type_id = c.user_type_id
WHERE ty.name = 'text' OR ty.name = 'ntext'
OR ty.name = 'image' OR ty.name = 'datetime'";
.
.
.
Assert.That(deprecatedColumns, Is.Empty, "Column types are deprecated (text,
ntext, image, datetime). Use varchar(max), nvarchar(max), varbinary(max) and
datetime2(0) instead.");
}
EXAMPLES (2)
ALTER PROCEDURE TryItOut.
AS BEGIN DECLARE @sum INT;
SELECT @sum = 1 + 2;
EXEC tSQLt.AssertEquals 3, @sum;
END GO
Video: http://www.youtube.com/watch?v=1w9XWzcFz0 (tsSQLt)
QUESTIONS
What Database Testing includes?
 What Database Objects can by tested?
 How many layers exists in a Application?
 What pproblems can happened if Database
Testing is Ignored?
 What we can Test at the DB Level? (Min 3)
