sim5102 software evaluation
DESCRIPTION
Measuring Internal Product Attributes :Flowgraph measurement(structure). 1. SIM5102 SOFTWARE EVALUATION. Objectives. Be able to measure internal product attributes based on flowgraph. 2. Overview from last lecture. McCabe's metric based on flowgraph Draw flowgraphs. 3. - PowerPoint PPT PresentationTRANSCRIPT
SIM5102SOFTWARE EVALUATION
Measuring Internal Product Attributes :Flowgraph measurement(structure)
1
Objectives Be able to measure internal product attributes
based on flowgraph
2
Overview from last lecture McCabe's metric based on flowgraph Draw flowgraphs
3
Flowgraph : Basic Control Structure
Sequence : eg a list of instructions with no other control structure involved
Selection : eg if ...then... else Iteration : eg do...while, repeat...until
4
Flowgraph : terminologies In-degree : number of arcs arrive at the node Out-degree : number of arcs leaves the node Procedure nodes : nodes with out-degree 1 Predicate nodes : nodes with out-degree other than 1 (except
stop node) Stop node : node with out-degree 0 Path : sequence of consecutive edges, may be traversed more
than once Simple path : traversing without repeating the edges
5
Basic flowgraph structures Sequence : Pn or Pn(X1,X2,...,Xn) or X1;X2;...Xn
Selection
6
x1 x2 x3 x4
t f
A
x
D0 or D0(A,X)if A then X
A
t f
X Y
D1 or D1(A,X,Y)if A then X else Y
Basic flowgraph structure (cont..)
7
A
...........
a1
a2an
X1 Xn
Cn or Cn(A, X1,X2,...,Xn)
Case A ofa1 : X1a2 : X2..an : Xn
Basic flowgraph structure Iteration
8
A
f t
D2 or D2(A,X)while A do X
X
X
At
f
D3 or D3(A,X)repeat X until A
Sequencing operation Let F1 and F2 be two flowgraphs. The sequence of F1 and F2 is the flowgraph
formed by merging the stop node of F1 with the start node of F2
The resulting flowgraph can be written as
F1;F2
Seq(F1,F2)
P2(F1,F2)9
Sequencing (cont...) Merging two flowgraphs
10
D1
D3
sequence
D1;D3
Nesting operation Let F1 and F2 be two flowgraphs. Suppose F1
has a procedure node X The nesting of F2 on to F1 at X is the
flowgraph formed from F1 by replacing the arc from X with the whole of F2
The resulting flowgraph can be written as
F1(F2 on X)
F1(F2)
11
Nesting (cont...)
12
D1
D3
Xwith
Nestedon X
D1(D3)
Prime flowgraph Flowgraphs that cannot be decomposed non-
trivially by sequencing or nesting Examples
Pn
D0, D1, D2 and D3
Cn
13
S-structured Graph A family (S) of prime flowgraph is called S-
structured Graph (or S-graphs) if it satisfies the following recursive rules:
1. Each member of S is S-structure
2. if F and G are S-structured flowgraphs, so is the sequences F;G and nesting of F(G)
3. No flowgraph is S-structured unless it can be generated by finite number of application of the above (step 2) rules
14
Prime decomposition Any flowgraph can be uniquely decomposed
into a hierarchy of sequencing and nesting primes
Decomposition tree – can be determined from a given graph
It describes how the flowgraph is built by sequencing and nesting
15
Hierarchical Measures
16
Assume that S in an arbitrary set of primes. We say a measure m is ahierarchical measure if it can be defined on the set of S-graphs by specifying
- m(F) for each F is a member of S (we call this as M1)
- the sequencing function(s) (e call this as M2)
- the nesting functions hF for each F is a member of S (we call this as M3)
Depth of Nesting Depth of nesting, a, for a flowgraph F can be
expressed in terms of:
- primes: a(P1) = 0, and if F is a prime is not equal to P1, then a(F) = 1
- sequence : a(F1;...;Fn) = max(a(F1),..,a(Fn))
- nesting : a(F(F1,...,Fn))
= 1 + max(a(F1),..,a(Fn))
17
Example F = D1((D0;P1;D2),D0(D3))
a(F) = 1 + max(a(D0;P1;D3),a(D0(D3)))
= 1 + max(max(a(D0),a(P1),a(D3)), 1 + a(D3))
= 1 + max(max(1,0,1), 1 + 1)
= 1 + max(1,2)
= 3
18
Test Coverage Measures Statement coverage
- a set of paths that every node lies on at least one path
Branch coverage
- a set of paths such that every edge lies on at least one path
All Path coverage
- exercising every single path
- infinite number if there any loop19
Test Coverage Measures Simple path coverage
- every path which does not contain the same edge more than once
Visit-each-loop
- branch coverage is satisfied
- for every loop, there are paths for each control flows both straight pass the loop and around the loop at least once
Linearly independent paths
- the execution of set of linearly independent paths
- an independent path must move along at least one edge that has not been traversed before the path is defined
20
Minimum Number of test cases Have to know the minimum number of test cases in
order to
- plan the testing
- generating data
- how long testing will take Minimum number of path m(F) can be computed from
the decomposition tree
- strategy of testing
- value for the primes, sequencing, and nesting
- appendix 8.10.4
21
Example : statement coverageF = D1((D0;P1;D2),D0(D3)) please refer to app. 8.10.4
m(F) = m(D1(D0;P1;D2),D0(D3))
= m(D0;P1;D2) + m(D0(D3))
= max(m(D0),m(P1),m(D2)) + m(D3)
= max(1,1,1) + 1
= 2
required paths : <2 10 12 14> <1 3 5 6 7 8 9>
22
Class exercisebegin
Read input list
if the list is empty then
output “list empty
else
begin
sum := 0;
repeat
read next list entry A;
sum := sum + A;
until end of list
output sum;
end;
end.
1. draw the flowgraph2. draw the decomposition tree3. write the expression for the decomposition tree4. calculate the depth of nesting using hierarchical measure5. compute the minimum number of test cases for statement coverage.
Software Architecture
Morphology
Morphology - example
Tree Impurity
Tree Impurity
Internal Reuse
Modules and Components
Software Architecture
Cohesion
Cohesion
Coupling
Coupling
Coupling : Representation
Information Flow Measures
Information Flow Measures
Information Flow Measures
Information Flow Measures