Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views30 pages

Lecture - Testing

The document discusses software testing, specifically focusing on basic path testing as a white box method introduced by McCabe. It explains cyclomatic complexity, which measures the number of independent paths in a program, and outlines the steps for basic path testing including drawing control flow graphs and generating test cases. Several examples illustrate the determination of nodes, edges, and predicate nodes in different control structures.

Uploaded by

asrashahid14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views30 pages

Lecture - Testing

The document discusses software testing, specifically focusing on basic path testing as a white box method introduced by McCabe. It explains cyclomatic complexity, which measures the number of independent paths in a program, and outlines the steps for basic path testing including drawing control flow graphs and generating test cases. Several examples illustrate the determination of nodes, edges, and predicate nodes in different control structures.

Uploaded by

asrashahid14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

SOFTWARE

ENGINEERING
LECTURE 10 - TESTING
WHAT IS TESTING
WHAT IS TESTING
TYPES
TYPES
TYPES
TYPES
TYPES
TYPES
TYPES
TYPES
BASIC PATH TESTING
INTRODUCTION
• A white box method
• Proposed by McCabe in 1980’s
• A hybrid of path testing and branch
testing methods.
• Based on Cyclomatic complexity and
uses control flow to establish the path
coverage criteria.
CYCLOMATIC
COMPLEXITY
• Developed by McCabe in 1976
• Measures the number of linearly
independent paths through a program.
• The higher the number the more
complex the code.
BASIC PATH TESTING
• Step 1: Draw a control flow graph.
• Step 2: Determine Cyclomatic
complexity.
• Step 3: Find a basis set of paths.
• Step 4: Generate test cases for each
path.
BASIC PATH TESTING
• Basic data flow structure
BASIC PATH TESTING
• Basic data flow structure
⮚Arrows or edges represent flows of
control.
⮚Circles or nodes represent actions.
⮚Areas bounded by edges and nodes
are called regions.
⮚A predicate node is a node containing
a condition.
BASIC PATH TESTING
• Draw basic data flow structure
1: IF A = 100
2: THEN IF B > C
3: THEN A = B
4: ELSEA= C
5: ENDIF
6: ENDIF
7: Print A
BASIC PATH TESTING
Determine Cyclomatic complexity
• There are several methods:
1. Cyclomatic complexity = edges - nodes + 2p

2. Cyclomatic complexity= Number of Predicate Nodes + 1


3. Cyclomatic complexity =number of regions in the
control flow graph
BASIC PATH TESTING
Determine Cyclomatic complexity
• Cyclomatic complexity = edges - nodes + 2p
• p = number of unconnected parts of the graph
BASIC PATH TESTING
Determine Cyclomatic complexity
• Cyclomatic complexity = edges - nodes + 2p
• p = number of unconnected parts of the graph
BASIC PATH TESTING
Determine Cyclomatic
complexity
Cyclomatic complexity=
Number of Predicate Nodes + 1
BASIC PATH TESTING
Determine Cyclomatic
complexity

Cyclomatic complexity =
number of regions in the control flow graph
BASIC PATH TESTING
Find a basis set of paths
BASIC PATH TESTING
EXAMPLES
EXAMPLE 1
1. If (num==1000)
2. statement 1
3. Else statement 2
4. Endif
-----------------------------
• No. of nodes =
• No. of edges =
• No. of predicate nodes =
EXAMPLE 2
1. If (num==1000)
2. statement 1
3. Else {statement 2
4. statement 3}
5. Endif
-----------------------------
• No. of nodes =
• No. of edges =
• No. of predicate nodes =
• No. of regions =
EXAMPLE 3
1. while (num==1000)
2. statements
3. End while
-----------------------------
• No. of nodes =
• No. of edges =
• No. of predicate nodes =

EXAMPLE 4
1. switch (ch)
2. { case ‘1’: s1; break;
3. case ‘2’: s2; break;
4. case ‘3’: s3; break;
5. case ‘4’: s4; break;
6. default: s5;}
7. end
-----------------------------
• No. of nodes =
• No. of edges =
• No. of predicate nodes =
EXAMPLE 5
if (1. a > 100 and 2. b < 200)
3. statement1
else
4. statement 2
5.elseif
-----------------------------
• No. of nodes =
• No. of edges =
• No. of predicate nodes =
• No. of regions =

You might also like