Академический Документы
Профессиональный Документы
Культура Документы
David Chays Polytechnic University Brooklyn, NY Joint work with Phyllis G. Frankl (Polytechnic) Saikat Dan (Polytechnic) Filippos Vokolos (Lucent Technologies) Elaine J. Weyuker (AT&T Labs - Research)
Motivation
Database systems play an important role in virtually every modern organization Faults can be very costly Programmers/testers may lack experience and/or time Little attention has been paid to DB application program correctness
Outline of Talk
Background Aspects of DB system correctness Issues in testing DB application programs Architecture of tool set Tool for generating database states Additional issues and approaches
DB
Relational databases
Data is viewed as a collection of relations
relation schema relation (relation state)
Tables, tuples, attributes, constraints for example, create table S (ssn char(11) primary key,
name char(25) not null)
Table S
Aspects of Correctness
Does the DBMS perform all operations correctly? Is concurrent access handled correctly? Is the system fault-tolerant? ... Does the application program behave as intended?
output
DB state
Billing table
customerID billing plan ...
Input customer ID and name of feature to which the customer wishes to subscribe. Invalid ID: return 0 feature unavailable in that area: return code 2 feature available but incompatible with existing features: return code 3 else update customers feature record, update billing table, return code 1
Problem:
must control and observe the DB state
Situations to Explore
Customer already subscribes to that feature Feature not available in customers area Feature available, but incompatible with other features customer already has Feature available and compatible with existing features Customer doesnt yet subscribe to any features ...
ID 011 ...
State Generator
Results
DB state generator
Inputs DB schema (in SQL) Parses schema to derive info about
attributes tables constraints : uniqueness, not-NULL, referential integrity inputs additional info from user suggested attribute values, divided into groups, similar to Category-Partition Testing [OstrandBalcer] additional annotations
Example Schema
create table s (sno char(5), sname char(20), status decimal(3), city char(15), primary key(sno)); create table p (pno char(6) primary key, pname char(20), color char(6), weight decimal(3), city char(15)); create table sp (sno char(5), pno char(6), qty decimal(5), primary key(sno,pno), foreign key(sno) references s, foreign key(pno) references p);
Stmt
Create Stmt Nodetag type = T_CreateStmt relname = s
Stmt
Create Stmt Nodetag type = T_CreateStmt relname = s
0
globalTablePointer
1 2 3
sno | F| F| char |F| F| |F| | ~nn | S | F| F| pr un sname | F| F|char | F| F| |F| | ~nn | S | F| F| ~pr ~un status | |F| F|decF|| ~pr | F| | ~nn S | F| F| F| ~un city | F| F|char | F| F| |F| | ~nn City | S | F| F| ~pr ~un pno || F| |F| F| F| F| F|| F| | ~nn P char | pr un pname | F| |F| F| F|~prF| ~un | ~nn P char | F| | F| color || F| |F| F| F|~prF| ~un | ~nn color P char | F| | F| weight | F| |F| F| F|~prF| ~un | ~nn weight| P dec | F| | F| city | P | char | ~pr | ~un | ~nn
cp cp cp cp cp cp cp cp cp
S |4|
0 1
P |5|
2 3 4
SP | 3 |
0 1 Null 2
sno |SP | char | pr | un | ~nn | foreign cp pno |SP | char | pr | un | ~nn | foreign cp qty |SP | dec | ~pr | ~un | ~nn cp
--choice_name: low 10 20 30 -----choice_name: medium 300 400 -----choice_name: high 5000 6000
cp
low
10 20 30
medium
300 400
high
5000 6000
DB table generation
Tester specifies table sizes Tool generates tuples for insertion
select data group or NULL, guided by annotations select value from data group, obeying constraints keep track of values used
city: --choice_name: domestic --choice_prob: 90 Brooklyn Florham-Park Middletown -----choice_name: foreign --choice_prob: 10 London Bombay
Table p pno P1 P2 P3 pname NULL Seats airbags color blue green yellow weight 100 300 500 city Brooklyn Florham-Park Middletown
Related work
Lyons-77, DB-Fill, TestBase Like our approach, rely on user to supply attribute values Do not handle integrity constraints as completely Require tester to describe tables in specialpurpose language (rather than SQL)
Summary
Issues Framework Prototype
Future Work
Refinement based on feedback from DB application developers / testers Other DB state generation heuristics
boundary values missing constraints difficult SQL features
Interplay between DB state and user inputs Checking DB state after test execution Checking application outputs