Download Document

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

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

Document related concepts
no text concepts found
Transcript
School of
Computer Science
Testing database systems
+ a little bit of slicing
ASTReNet Workshop
David Willmor
Informatics Process Group
School of Computer Science
The University of Manchester
1
School of
Computer Science
Database systems
• Program state
– Volatile
– Structured according to a type system
• Database state
– Persistent
– Structured according to a data model
Program 1
Program 2
Database
2
School of
Computer Science
START
Database operations
• Interact with database state
– intensional (or extensional)
• Intensional relational algebra
– subset of the database state
read (read)
– subset of the database state
inserted or updated (add)
– subset of the database state
deleted (del)
01
Database
Statement
02
Rollback
Statement
03
Commit
Statement
04
07
05
08
06
09
• Used for slicing – Willmor, Embury &
Shao ICSM’04
10
STOP
3
School of
Computer Science
Database dependencies
START
• Slicing
– What a statement is dependent
upon?
– Extra dependencies for database
state (& interactions between
states)
01
Database
Statement
02
Rollback
Statement
03
Commit
Statement
04
07
05
08
06
• Testing
– Define use pairs
– a statement add/deletes and
then another reads
09
10
STOP
4
School of
Computer Science
The data model (schema)
• Rich store of information about the behaviour of SQL
queries
– INSERT INTO employee VALUES (“bob”, “m”,
“10/06/75”, true);
– SELECT * FROM supervisor;
– CREATE VIEW supervisor AS SELECT * FROM
employee WHERE supervisor = true;
5
School of
Computer Science
The data model (schema)
• Another example…
– DELETE FROM reviewing WHERE
reviewingid = 1;
– CREATE TABLE score(…..
FOREIGN KEY (reviewingid) REFERENCES
reviewing(reviewingid) ON DELETE CASCADE);
– Cascading delete
REFERENTIAL INTEGRITY!!
6
School of
Computer Science
START
Database transactions
• Logical grouping of database
operations
01
Database
Statement
02
Rollback
Statement
03
Commit
Statement
– Succeed or fail together
• Commit
– Writes each statement to the
database
• Abort/Rollback
– Discards the effect of each
operation
– Database is in state prior to
transaction
04
07
05
08
06
09
10
STOP
7
School of
Computer Science
Effect of persistence
START
• One execution can effect a
later execution
01
Database
Statement
02
Rollback
Statement
• A use can occur before its
definition!
03
Commit
Statement
• Define—use pairs that exist
over time
04
07
05
08
06
09
10
• And further complications…
STOP
8
School of
Computer Science
Effect of multiple programs
• Execution of one program
can effect another program
START
01
Database
Statement
02
Rollback
Statement
03
Commit
Statement
START
01
• Each program interacts via
the SAME database state
03
02
04
07
05
08
06
04
• Define—use pairs can exist
between programs
05
09
07
06
• Programs can access the
database concurrently
10
08
STOP
09
10
STOP
9
School of
Computer Science
Fixed or evolving database states
• Traditional system… if environment remains
constant (i.e. controlled testing)…
– identical input = identical behaviour
– Key concept of a number of testing practices i.e., Rothermel
& Harrold safe regression test selection
• Fixed database….
– identical input = identical behaviour
• Evolving database…
– identical input != identical behaviour
10
School of
Computer Science
What is a test case?
• Test case for database systems:





P – the program under test
i – the application input
o – the application output
Dic – initial database state
Doc – resultant database state
 Database states – extensional or intensional
11
School of
Computer Science
Extensional vs intensional states
• Extensional: entire state is specified
– Easy to capture
– Difficult to maintain
– Costly to reason over
• Intensional: description of state is specified
– Difficult to capture
– Easier to maintain
– Cheap to reason over
12
School of
Computer Science
Conclusions…
• What are we working on…
– Safe regression test selection for database
systems (submitted for publication)
– Test Adequacy for database systems (submitted for
publication)
– Ordering test cases based on intensional
descriptions (in preparation)
– Testing the future using hypothetical databases
(working on…)
– http://www.cs.man.ac.uk/~willmord/ papers & reports
coming soon….
13
School of
Computer Science
Open question
• Can test cases be automatically generated if you
don’t know the database state?
Controversial point
• Source code analysis is more accurate when you
consider the data model
• Real world database state is more useful than
synthetic generated states
14
Related documents