sim5102 software evaluation

40
SIM5102 SOFTWARE EVALUATION Measuring Internal Product Attributes :Flowgraph measurement(structure) 1

Upload: diza

Post on 06-Feb-2016

34 views

Category:

Documents


0 download

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 Presentation

TRANSCRIPT

Page 1: SIM5102 SOFTWARE EVALUATION

SIM5102SOFTWARE EVALUATION

Measuring Internal Product Attributes :Flowgraph measurement(structure)

1

Page 2: SIM5102 SOFTWARE EVALUATION

Objectives Be able to measure internal product attributes

based on flowgraph

2

Page 3: SIM5102 SOFTWARE EVALUATION

Overview from last lecture McCabe's metric based on flowgraph Draw flowgraphs

3

Page 4: SIM5102 SOFTWARE EVALUATION

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

Page 5: SIM5102 SOFTWARE EVALUATION

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

Page 6: SIM5102 SOFTWARE EVALUATION

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

Page 7: SIM5102 SOFTWARE EVALUATION

Basic flowgraph structure (cont..)

7

A

...........

a1

a2an

X1 Xn

Cn or Cn(A, X1,X2,...,Xn)

Case A ofa1 : X1a2 : X2..an : Xn

Page 8: SIM5102 SOFTWARE EVALUATION

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

Page 9: SIM5102 SOFTWARE EVALUATION

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

Page 10: SIM5102 SOFTWARE EVALUATION

Sequencing (cont...) Merging two flowgraphs

10

D1

D3

sequence

D1;D3

Page 11: SIM5102 SOFTWARE EVALUATION

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

Page 12: SIM5102 SOFTWARE EVALUATION

Nesting (cont...)

12

D1

D3

Xwith

Nestedon X

D1(D3)

Page 13: SIM5102 SOFTWARE EVALUATION

Prime flowgraph Flowgraphs that cannot be decomposed non-

trivially by sequencing or nesting Examples

Pn

D0, D1, D2 and D3

Cn

13

Page 14: SIM5102 SOFTWARE EVALUATION

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

Page 15: SIM5102 SOFTWARE EVALUATION

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

Page 16: SIM5102 SOFTWARE EVALUATION

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)

Page 17: SIM5102 SOFTWARE EVALUATION

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

Page 18: SIM5102 SOFTWARE EVALUATION

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

Page 19: SIM5102 SOFTWARE EVALUATION

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

Page 20: SIM5102 SOFTWARE EVALUATION

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

Page 21: SIM5102 SOFTWARE EVALUATION

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

Page 22: SIM5102 SOFTWARE EVALUATION

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

Page 23: SIM5102 SOFTWARE EVALUATION

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.

Page 24: SIM5102 SOFTWARE EVALUATION

Software Architecture

Page 25: SIM5102 SOFTWARE EVALUATION

Morphology

Page 26: SIM5102 SOFTWARE EVALUATION

Morphology - example

Page 27: SIM5102 SOFTWARE EVALUATION

Tree Impurity

Page 28: SIM5102 SOFTWARE EVALUATION

Tree Impurity

Page 29: SIM5102 SOFTWARE EVALUATION

Internal Reuse

Page 30: SIM5102 SOFTWARE EVALUATION

Modules and Components

Page 31: SIM5102 SOFTWARE EVALUATION

Software Architecture

Page 32: SIM5102 SOFTWARE EVALUATION

Cohesion

Page 33: SIM5102 SOFTWARE EVALUATION

Cohesion

Page 34: SIM5102 SOFTWARE EVALUATION

Coupling

Page 35: SIM5102 SOFTWARE EVALUATION

Coupling

Page 36: SIM5102 SOFTWARE EVALUATION

Coupling : Representation

Page 37: SIM5102 SOFTWARE EVALUATION

Information Flow Measures

Page 38: SIM5102 SOFTWARE EVALUATION

Information Flow Measures

Page 39: SIM5102 SOFTWARE EVALUATION

Information Flow Measures

Page 40: SIM5102 SOFTWARE EVALUATION

Information Flow Measures