Académique Documents
Professionnel Documents
Culture Documents
pair if the def occurs after the use and the node is in a loop
( numbers )
sum = 0
length = numbers.length
i=0
i >= length
i < length
sum += numbers [ i ]
i++
i >= length
i < length
7
varsum =
i++
def (2) = { i }
Def
Use
{ numbers, sum,
length }
{i}
{ numbers }
{ sum, i }
{ med, mean,
varsum, i }
{ numbers, i, sum }
{ numbers, length, sum }
{ varsum, i }
{ var, sd }
Use
(1, 2)
(2, 3)
(3, 4)
(4, 3)
{ i, length }
(3, 5)
{ i, length }
(5, 6)
6
7
Edge
{ varsum, numbers, i,
mean }
{ varsum, length, var,
mean, med, var, sd }
(6, 7)
{ i, length }
(7, 6)
(6, 8)
{ i, length }
DU Pairs
(5, 8)
(8, 8)
(8, 8)
(5, 7) (5, 8)
(1, 4) (1, 5) (4, 4) (4, 5)
varsum
i
length
med
var
sd
sum
DU Pairs
DU Paths
(1, 4)
(1, 5)
(1, 7)
[ 1, 2, 3, 4 ]
[ 1, 2, 3, 5 ]
[ 1, 2, 3, 5, 6, 7 ]
(1, 5)
(1, 8)
(1, (3,4))
(1, (3,5))
(1, (6,7))
(1, (6,8))
[ 1, 2, 3, 5 ]
[ 1, 2, 3, 5, 6, 8 ]
[ 1, 2, 3, 4 ]
[ 1, 2, 3, 5 ]
[ 1, 2, 3, 5, 6, 7 ]
[ 1, 2, 3, 5, 6, 8 ]
(5, 8)
(8, 8)
(8, 8)
(1, 4)
(1, 5)
(4, 4)
(4, 5)
[ 5, 6, 8 ]
No path needed
No path needed
[ 1, 2, 3, 4 ]
[ 1, 2, 3, 5 ]
[ 4, 3, 4 ]
[ 4, 3, 5 ]
variable
mean
DU Pairs
(5, 7)
(5, 8)
DU Paths
[ 5, 6, 7 ]
[ 5, 6, 8 ]
varsum
(5, 7)
(5, 8)
(7, 7)
(7, 8)
[ 5, 6, 7 ]
[ 5, 6, 8 ]
[ 7, 6, 7 ]
[ 7, 6, 8 ]
(2, 4)
(2, (3,4))
(2, (3,5))
(4, 4)
(4, (3,4))
(4, (3,5))
(5, 7)
(5, (6,7))
(5, (6,8))
(7, 7)
(7, (6,7))
(7, (6,8))
[ 2, 3, 4 ]
[ 2, 3, 4 ]
[ 2, 3, 5 ]
[ 4, 3, 4 ]
[ 4, 3, 4 ]
[ 4, 3, 5 ]
[ 5, 6, 7 ]
[ 5, 6, 7 ]
[ 5, 6, 8 ]
[ 7, 6, 7 ]
[ 7, 6, 7 ]
[ 7, 6, 8 ]
Summary
Applying the graph test criteria to control flow graphs is
relatively straightforward
Most of the developmental research work was done with CFGs
Questions?
In General
Number of
program Paths
Path Coverage
Number of
Basis Paths
=>
Basis Paths
Coverage
=>
Branch Coverage
Exercise
1.
2.
3.
4.
Questions?
Next.
Levels of Testing, Junit Testing Framework
Levels of Testing
Lowlevel testing
Unit (module) testing
Integration testing
Highlevel testing
System testing
Function testing
Acceptance testing
Customer
Testing Terms
Test case A set of Inputs, execution preconditions, and
A Testing Process
Unit Testing
Done on individual units (Class or small cluster classes in
OO System and a function or modules in Procedural
Systems)
Test unit w.r.to unit specification
Mostly done by developers/programmers
requires stubs and drivers
Further Popularized by the availability of Unit Testing
Frameworks
10
Driver:
Code that executes unit
under test
Integration Testing
Tests a group of units, modules, or a subsystem
Test subsystem structure w.r.to design, subsystem
functions
Focuses on unit interfaces
Done by one/group of developers
Undertaken based on dependency considerations
11
Comparison
NonIncremental
Incremental
12
13
Top-down Integration
Begin with the top module in the module call hierarchy
Stub modules are produced
Stubs are often complicated
The next module to be tested is any module with at
least one previously tested super-ordinate (calling)
module
After a module has been tested, one of its stubs is
replaced by an actual module (the next one to be tested)
and its required stubs
14
15
System Testing
16
Questions??
Next Lecture.
More on Levels of Testing, Junit Testing Framework
17