White Box Basics - PowerPoint PPT Presentation

1 / 67
About This Presentation
Title:

White Box Basics

Description:

Title: Slide 1 Author: Dr. Wolfgang J. Schneider Last modified by: Dr. Wolfgang Schneider Created Date: 12/25/2005 6:24:10 PM Document presentation format – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 68
Provided by: DrW73
Category:

less

Transcript and Presenter's Notes

Title: White Box Basics


1
White Box Basics Part 3
  • Complexity 1

2
COVERAGE Simple Structure
What did we learn so far ? We found out a lot
about Statement Coverage Anweisungsüberdeckung B
ranch Coverage Zweigüberdeckung Path
Coverage Pfadüberdeckung We are not
so sure about Branch Conditions
3
COVERAGE Simple Structure
We had a close look at some simple structures. I
called them Mickey Mouse structures
4
COVERAGE Simple Structure
5
COVERAGE Simple Structure
proc1
proc2
proc3
6
COVERAGE Simple Structure
NOT SO SIMPLE ANY MORE
7
COMPLEXITY
  • We have to find a
  • Measure for the
  • Complexity of our
  • Test Objects

8
COMPLEXITY
9
COMPLEXITY
THIS IS AN
EDGE
KANTE
10
COMPLEXITY
THIS IS A
NODE
KNOTEN
11
COMPLEXITY
EDGES
12
COMPLEXITY
EDGES
NODES
13
COMPLEXITY
EDGES
NODES
14
COMPLEXITY
EDGES
NODES
EDGE ?
15
COMPLEXITY
EDGES
NODES
NODE ?
16
COMPLEXITY
NODE
EDGES
NODES
17
COMPLEXITY
NODE
EDGES
NODES
18
COMPLEXITY
NODE
EDGES
NODES
19
COMPLEXITY
EDGES
NODES
20
COMPLEXITY
This looks too simple
Lets make it look like it was made by a GENIUS
!
21
COMPLEXITY
22
COMPLEXITY
Lets tidy this up !
23
COMPLEXITY
24
COMPLEXITY
25
COMPLEXITY
We have got four NODES
26
COMPLEXITY
e1
e2
e4
e3
We have got four EDGES
27
COMPLEXITY
e1
e2
e4
e3
n 4 e 4 e n 0
28
COMPLEXITY
n 6 e 6 e n 0
Lets add Terminators
29
COMPLEXITY
  • We have added two nodes
  • We have added two edges
  • We did not add complexity

n 6 e 6 e n 0
n 4 e 4 e n 0
30
COMPLEXITY
n 6 e 6 e n 0
Control Flow Graph
Kontrollfluss-Graph
Now lets give it a nice Name
31
COMPLEXITY
n 6 e 7 e n 1
32
COMPLEXITY
n 7 e 8 e n 1
33
COMPLEXITY
n 11 e 13 e n 2
34
COMPLEXITY
  • The Difference Edges - Nodes
  • gives us a clue about Complexity

n 11 e 13 e n 2
n 4 e 4 e n 0
35
COMPLEXITY
n 6 e 5 e n -1
36
COMPLEXITY
Do you think this structure has
NEGATIVE Complexity ?
37
COMPLEXITY
I think it rather has ZERO Complexity
38
COMPLEXITY
  • The Difference Edges - Nodes
  • gives us a clue about Complexity

e n 1
39
COMPLEXITY
Professor McCabe says it has a Complexity of ONE
40
COMPLEXITY
  • I do not want to argue about that

e n 2
41
COMPLEXITY
  • Cyclomatic Complexity
  • Zyklomatische Zahl

e n 2
42
COMPLEXITY
This measure is often used for Risk Analysis
Cyclomatic Complexity Risk Evaluation
1-10 a simple program, without much risk
11-20 more complex, moderate risk
21-50 complex, high risk program
greater than 50 untestable program (very high risk)
43
COMPLEXITY
CC 1 We will need 1 Case for Statement Coverage
44
COMPLEXITY
CC 1 C0 1 We will need 1 Case
for Branch Coverage
45
COMPLEXITY
CC 1 C0 1 C1 1 We will need 1 Case
for Path Coverage
46
COMPLEXITY
CC 1 C0 1 C1 1 C2 1
47
COMPLEXITY
n 6 e 6 e n 0 CC 2
48
COMPLEXITY
CC 2 C0 1 C1 2 C2 2
49
COMPLEXITY
CC 3 C0 1 C1 2 C2 4
50
COMPLEXITY
n 11 e 13 e n 2
51
COMPLEXITY
CC 4 C0 ? C1 ? C2 ?
52
COMPLEXITY
CC 4 C0 ? C1 ? C2 ?
3 Test Cases for Statement Coverage
53
COMPLEXITY
CC 4 C0 3 C1 ? C2 ?
3 Test Cases for Branch Coverage
54
COMPLEXITY
CC 4 C0 3 C1 3 C2 ?
6 Test Cases for Path Coverage
55
COMPLEXITY
CC 4 C0 3 C1 3 C2 6
56
COMPLEXITY
n 8 e 10 e n 2
57
COMPLEXITY
CC 4 C0 ? C1 ? C2 ?
n 8 e 10 e n 2
58
COMPLEXITY
CC 4 C0 ? C1 ? C2 ?
1 Test Case for Statement Coverage
59
COMPLEXITY
CC 4 C0 1 C1 ? C2 ?
3 Test Cases for Branch Coverage
60
COMPLEXITY
CC 4 C0 1 C1 3 C2 ?
6 Test Cases for Path Coverage
61
COMPLEXITY
CC 4 C0 1 C1 3 C2 6
62
COMPLEXITY
CC 3 C0 1 C1 2 C2 4
CC 2 C0 1 C1 2 C2 2
CC 1 C0 1 C1 1 C2 1
CC 4 C0 1 C1 3 C2 6
CC 4 C0 3 C1 3 C2 6
CC 4 C0 3 C1 3 C2 6
63
COMPLEXITY
  • Obviously,
  • higher Cyclomatic Complexity
  • means more Test Cases

64
COMPLEXITY
  • Obviously,
  • higher Cyclomatic Complexity
  • means more Test Cases
  • Especially, C2 grows fast

65
COMPLEXITY HOMEWORK
  • start
  • if C1 true
  • then do P1
  • if C2 true
  • then do P3
  • else do P4
  • endif
  • else do P2, P5
  • endif
  • if C3 true
  • then do P6
  • else
  • if C4 true
  • then do P7
  • else do P8, P9
  • endif
  • do P10, P11
  • endif
  • end
  • Draw a flowchart of
  • this procedure (with the
  • yes-branches to the left
  • and the no-branches to
  • the right)

66
COMPLEXITY HOMEWORK
  • Convert the flowchart to
  • a diagram like that
  • Control Flow Graph
  • 3. Calculate the Complexity
  • 4. Calculate C0
  • 5. Calculate C1
  • 6. Calculate C2

67
Dr. Wolfgang J. Schneider - Start
DR. WOLFGANG J. SCHNEIDER GMBH International
Information Technology Consultants
Professional Testing Solutions Telecommunications
and Utility Billing Systems Euro Preparation for
Companies in New EU Member Countries EDIFACT
DATANORM ELDANORM ETIM Interfaces Data
Exchange with Banks and Credit Card
Companies Total Quality Management Good
Manufacturing Practices IT Service Management -
IT Infrastructure Library (ITIL) Knowledge
Management Solutions IT Fitness for GAAP IAS
FASB Balanced Scorecard
www.drschneider.at
Take Advantage of 30 Years of IT Experience !
Write a Comment
User Comments (0)
About PowerShow.com