STM Unit1 Part2
STM Unit1 Part2
part2
Decisions
Case Statements
Junctions
Process Block
process block is a piece of straight line code of one
statement or more number of statements.
A>B
? NO: then B is biggest
number
Decisions
Here the condition is A>B and the decision
is based on the condition .
If A>B is true then “1.YES: then A is
A>B
?
2.NO: then B is biggest
number
Case Statements
A case statement is a multi-way branch
or decisions.
In case statement ,multiple cases are
there like case1,case2,…….case N.
Based on ‘Case of’ value the
appropriate ‘case’ is executed.
1 Case 1
Case of
21 Case 2
N Case N
Junctions
A junction is a point in the program
where the control flow can merge.
Junctions 1 2
Path Testing- paths, nodes and
links
Path: a path through a program is a sequence of
instructions or statements that starts at an entry,
junction, or decision and ends at another, or possibly
the same junction, decision, or exit.
A path may go through several junctions, processes,
or decisions, one or more times.
Paths consists of segments.
The segment is a link – a single process that lies
between two nodes.
A path segment is succession of consecutive links
that belongs to some path.
The length of path measured by the number of
links in it and not by the number of the instructions
or statements executed along the path.
The name of a path is the name of the nodes along
the path.
Fundamental Path Selection
Criteria
yes
X=X+A
X<0 200 X=X+A 300
? no
Path Testing Criteria
Any testing strategy based on paths must at least
both exercise every instruction and take branches in
all directions.
Inner loop
1 2 3 4
loop1 loop2
1 2 3 4
Horrible loops
A Horrible Loop is a combination of
nested loops and concatenatedloops.
1 2 3 4 5 6
Predicates, Predicate Expressions
Predicate: The logical function evaluated at a
decision : True or False.
Path Predicate :
• A predicate associated with a path is called path
predicate.
• Every path corresponds to a succession of
True/False values for the predicates traversed on
that path.
Path Predicate Expressions
A path predicate expression is a set of
Boolean expressions
1. (A>B) AND (A>C)
2. (A>B) OR (A>C)
3. NOT(A>B)
Boolean algebra notation to denote the
Boolean expression:
ABCD+EBCD=(A+E)BCD
Testing Blindness
Testing Blindness is a pathological
situation in which the desired path is
achieved for the wrong reason.
There are three types of Testing Blindness:
Assignment Blindness
Equality Blindness
Self Blindness
Path Sensitizing
The act of finding a set of solutions to the path predicate
expression is called PATH SENSITIZATION
For any path in that set, interpret the predicates along the
path as needed to express them in terms of the input
vector.
In general individual predicates are compound or may
become compound as a result of interpretation.
Path Sensitizing
Trace the path through, multiplying the individual
compound predicates to achieve a Boolean expression
such as:
A(B+C)
[m]
[n]
[r]
[s]
Two link marker method
The solution to the problem of single
link marker method is to implement two
markers per link: one at the beginning
of each link and on at the end.
The two link markers now specify the
path name and confirm both the
beginning and end of the link.
Example - Two link marker
[m] [n]
[o]