Loops, Path Predicates, Path Sensitizing, Path Instrumentation
Loops, Path Predicates, Path Sensitizing, Path Instrumentation
LOOPS:
Cases for a single loop: A Single loop can be covered with two cases: Looping and Not looping. But,
experience shows that many loop-related bugs are not discovered by C1+C2. Bugs hide themselves in
corners and congregate at boundaries.
(THESE THREE CASES ARE FOR REFERNCE PURPOSE ONLY, GO THROUGH IT)
KINDS OF LOOPS: There are only three kinds of loops with respect to path testing:
Horrible Loops:
A horrible loop is a combination of nested loops, the use of code that jumps into and out of loops,
intersecting loops, hidden loops, and cross connected loops.
Page 2
SOFTWARE TESTING METHODOLOGIES
Department of CSE
Page 3
SOFTWARE TESTING METHODOLOGIES
Department of CSE
Put in limits or checks that prevent the combined extreme cases. Then you have to test the software
that implements such safety measures.
Page 4
SOFTWARE TESTING METHODOLOGIES
Department of CSE
PREDICATE: The logical function evaluated at a decision is called Predicate. The direction taken at a
decision depends on the value of decision variable.
PATH PREDICATE: A predicate associated with a path is called a Path Predicate. For example, "x is
greater than zero", "x+y>=90", "w is either negative or equal to 10 is true" is a sequence of predicates
whose truth values will cause the routine to take a specific path.
INPUTS:
In testing, the word input is not restricted to direct inputs, such as variables in a subroutine call, but
includes all data objects referenced by the routine whose values are fixed prior to entering it. For
example, inputs in a calling sequence, objects in a data structure, values left in registers, or any
combination of object types.
The input for a particular test is mapped as a one dimensional array called as an Input Vector.
PREDICATE INTERPRETATION:
The simplest predicate depends only on input variables.
example, assume a predicate x1+y>=0 that along a path prior to reaching this predicate we had the
assignment statement y=x2+7. Although our predicate depends on processing, we can substitute the
symbolic expression for y to obtain an equivalent predicate x1+x2+7>=0.
The act of symbolic substitution of operations along the path in order to express the predicate solely
in terms of the input vector is called predicate interpretation.
Sometimes the interpretation may depend on the path;
FOR YOUR REFERENCE ONLY{ ((for example, INPUT X ON X GOTO A,
B, C, ...
Page 5
SOFTWARE TESTING METHODOLOGIES
of CSE
The path predicates take on truth values based on the values of input variables, either
directly or indirectly.
A predicate whose truth value can change as a result of the processing is said to be process
dependent and one whose truth value does not change as a result of the processing is process
independent.
Process dependence of a predicate does not always follow from dependence of the input
variables on which that predicate is based.
Any set of input values that satisfy all of the conditions of the path predicate expression will
force the routine to the path. Sometimes a predicate can have an OR in it.
PREDICATE COVERAGE:
Page 6
SOFTWARE TESTING METHODOLOGIES
Department of CSE
Compound Predicate: Predicates of the form A OR B, A AND B and more complicated Boolean
expressions are called as compound predicates.
Sometimes even a simple predicate becomes compound after interpretation. Example: the
predicate if (x=17) whose opposite branch is if x.NE.17 which is equivalent to x>17. Or. X<17.
Predicate coverage is being the achieving of all possible combinations of truth values
corresponding to the selected path have been explored under some test
TESTING BLINDNESS:
Testing Blindness is a pathological (harmful) situation in which the desired path is achieved for the
wrong reason. There are three types of Testing Blindness:
Assignment Blindness: o Assignment blindness occurs when the buggy predicate appears to work
correctly because the specific value chosen for an assignment statement works with both the correct
and incorrect
predicate.
o For Example:
Correct Buggy
X = 7 X=7
........ ........
if Y > 0 if X+Y > 0 then ...
then ...
o If the test case sets Y=1 the desired path is taken in either case, but there is still a bug
Equality Blindness:
o Equality blindness occurs when the path selected by a prior predicate results in a value that works both
for the correct and buggy predicate.
o For Example:
Correct Buggy
if Y = 2 then if Y = 2 then ........
........ if X+Y > 3 if X > 1
then ... then ...
o The first predicate if y=2 forces the rest of the path, so that for any positive value of x. the path taken at
the second predicate will be the same for the correct and buggy version.
Page 7
SOFTWARE TESTING METHODOLOGIES
Department of CSE
Self Blindness:
o Self blindness occurs when the buggy predicate is a multiple of the correct predicate and as a result is
indistinguishable along that path. o For Example:
Correct Buggy
X=A X=A
........ ........
if X-1 > 0 if X+A-2 > 0
then ... then ...
1. The assignment (x=a) makes the predicates multiples of each other, so the direction taken is the same for the correct and buggy
version.
PATH SENSITIZING:
Page 8
SOFTWARE TESTING METHODOLOGIES
Department of CSE
7. Last, use correlated, dependent predicates.
PATH INSTRUMENTATION:
1. Path instrumentation is what we have to do to confirm that the outcome was achieved by the intended
path.
2. Co-incidental Correctness: The coincidental correctness stands for achieving the desired outcome for
wrong reason.
1. Interpretive Trace Program: o An interpretive trace program is one that executes every statement in
order and records the intermediate values of all calculations, the statement labels traversed etc.
o If we run the tested routine under a trace, then we have all the information we need to confirm it was
achieved by the intended path.
o The trouble with traces is that they give us far more information than we need. In fact, the typical trace
program provides so much information
Page 9
SOFTWARE TESTING METHODOLOGIES
Department of CSE
Page 10
SOFTWARE TESTING METHODOLOGIES
Department of CSE
P
age 11 SOFTWARE TESTING METHODOLOGIES
Department of CSE
P
age 12 SOFTWARE TESTING METHODOLOGIES