Download presentation
Presentation is loading. Please wait.
Published byMagdalen Baldwin Modified over 9 years ago
1
A Framework for Testing Database Application Author: David Chays, Saikat Dan, Filippos I. Vokolos, Elaine J. Weyuker Presenter: Liping Liu
2
Outline Motivation Background Issues in testing DB application Testing tool Conclusion
3
Motivation Important role of DB system DB application program in semi- declarative language; many testing techniques for programs in imperative language Different input and output space of DB application
4
Background Focus on Relational DB and SQL Data is viewed as a collection of relations relation schema relation (relation state): element of Cartesian product Tables, tuples, attributes, constrains Constrain: Domain Constrain Uniqueness Constrain not-NULL Constrain Referential Integrity (foreign key) Semantic Integrity (general)
5
Correctness (def) Does the DBMS perform all operations correctly? Protect security and privacy? Is the system fault-tolerant?... Does the application program behave as intended?
6
Issues in DB application traditional imperative nature DB declarative nature input output input DB state output DB state
7
Example: Customer-feature table Customer ID, feature name Customer ID invalid-> return 0; Feature invalid-> return 0; ID and feature valid, feature available- >return 1; Feature not available->return 2; New feature incompatible with old feature- >return 3;
8
example Naïve approach I = {customer-IDs} X {feature-names} 0 = {0,1,2,3} More suitable approach: I = {customer-IDs} X {feature-names} X {database-states} 0 = {0,1,2,3} X {database-states}
9
DB state Ways to deal with DB state: ignore as environment as part of input and output space Problems: Controllability: at desired state before execution->populate DB with appropriate data Observability: observe the state after execution->check the state of DB after execution
10
DB state How to obtain DB state Live data not reflect sufficiently wide variety of situations difficult to find the situations of interest violate privacy or security constraints Synthetic data Generating domain elements and gluing them together generate interesting data that obey integrity constraints Use schema and user supplied info
11
Suggestions from tester DB schema App source App exec User input Output DB state Results Input Generator State Generator State Validator Output Verifier Log file
12
Tool State Generator Input: DB schema, user info (suggested value) Populate DB state Input Generator Input: info from State Generator, info of query Generate input data for test cases Output Verifier Input: output of test case Check with expected value State Validator Check state after execution
13
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
14
P | 5 | pname | F| F| F| F| F| F| F| pno | F| F| F| F| F| F| F| weight| F| F| F| F| F| F| F| color | F| F| F| F| F| F| F| 0123401234 city | P | char | ~pr | ~un | ~nn pname | P | char | ~pr | ~un | ~nn pno | P | char | pr | un | ~nn weight | P | dec | ~pr | ~un | ~nn color | P | char | ~pr | ~un | ~nn 01230123 cp S | 4 | globalTablePointer sname | F| F| F| F| F| F| F| sno | F| F| F| F| F| F| F| City | F| F| F| F| F| F| F| status | F| F| F| F| F| F| F| 01230123 sname | S | char | ~pr | ~un | ~nn sno | F| F| F| F| F| F| F| City | F| F| F| F| F| F| F| status | F| F| F| F| F| F| F| 01230123 sno | S | char | pr | un | ~nn city | S | char | ~pr | ~un | ~nn status | S | dec | ~pr | ~un | ~nn 01230123 cp SP | 3 | Null pno |SP | char | pr | un | ~nn | foreign sno |SP | char | pr | un | ~nn | foreign qty |SP | dec | ~pr | ~un | ~nn 012012 cp Data structure S: supplier; P: part
15
Category Partition Each category (column) can have a list of choices pointed to by cp. cp lowhighmedium 10 20 30 300 400 5000 6000
16
Populated DB table 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 Outputs sequence of SQL insert statements
17
Example snopnoqty S1P15000 S1P2300 S1P310 S2P16000 S2P2400 S2P35000 S3P120 S3P2300 S3P330 S4P16000 pnopnamecolorweightcity P1NULLblue100Brooklyn P2Seatsgreen300Florham-Park P3airbagsyellow500Middletown snosnamestatuscity S1NULL0Brooklyn S2Smith1Florham-Park S3JonesNULLLondon S4BlakeNULLMiddletown Table sTable sp Table p
18
Conclusion Issues in testing DB application Framework: DB state Testing tool: focus on the state generator
19
Future work Future work: An GENDA for testing relational database applications 5 components: AGENDA Parser Data structure ->AGENDA DB; avoids memory issue; more accessible Interested? http://cis.poly.edu/~ytdeng/paper/js tvr_2004.pdf http://cis.poly.edu/~ytdeng/paper/js tvr_2004.pdf
20
Thanks!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.