Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

DEPARTMENT OF AI&DS

COURSE NAME –SOFTWARE RELIABILITY


COURSE CODE – 21CS3258R
Topic:
MCCABE’S CYCLOMATICCOMPLEXITY METRIC

SESSION - 4
AIM OF THE SESSION

To familiarize students with the basic concept of McCabe’s CyclomaticComplexity metric

INSTRUCTIONAL OBJECTIVES

This Session is designed to:


1. Define Cyclomatic Complexity
2. Define Graph Complexity
3. Describe basis path testing

LEARNING OUTCOMES

At the end of this session, you should be able to:


1. Define Cyclomatic Complexity
2. Define Graph Complexity
3. Describe basis path testing

2
MCCABE’S CYCLOMATIC COMPLEXITY METRIC

• A software metric used to measure the complexity of


software
• Developed by Thomas McCabe
• Described (informally) as the number of decision
points + 1
Cyclomatic Complexity V(G)

Computing the cyclomatic


complexity:

number of simple decisions + 1

or

number of enclosed areas + 1

In this case, V(G) = 4


Graph Complexity
(Cyclomatic Complexity)
A number of industry studies have indicated
that the higher V(G), the higher the probability
or errors.

modules

V(G)

modules in this range are


more error prone
Basis Path Testing
Next, we derive the
independent paths:
1

Since V(G) = 4,
2 there are four paths

3 Path 1: 1,2,3,6,7,8
4
5 6 Path 2: 1,2,3,5,7,8
Path 3: 1,2,4,7,8
Path 4: 1,2,4,7,2,4,...7,8
7
Finally, we derive test
cases to exercise these
8
paths.
WHAT IS THE COMPLEXITY?
public void howComplex() {
int i=20;

while (i<10) {
System.out.printf("i is %d", i);
if (i%2 == 0) {
System.out.println("even");
} else {
System.out.println("odd");
}
}
}
WHAT IS THE COMPLEXITY V(G)?
public void howComplex() {
int i=20;

while (i<10) {
System.out.printf("i is %d", i);
if (i%2 == 0) {
System.out.println("even");
} else {
System.out.println("odd");
}
}
}

V(G) = 2 enclosed area + 1 = 3


OUTPUT FROM JAVANCSS
SELF-ASSESSMENT QUESTIONS

1. Define Cyclomatic Complexity


2. Define Graph Complexity
3. Describe basis path testing
REFERENCES FOR FURTHER LEARNING OF THE
SESSION

Reference Books:
TEXT BOOKS:

Gopala swamy ramesh, srinivasan desikan,“software reliability engineering” – , McGrawHill


Education Edition,(2000)
Mukesh Singhal and Nagesh N. Karanth,”Software Reliability Engineering” – A Practitioner's
Approach McGraw-Hill Education ,2003,.

Reference Book
Software Reliability Measurement, Prediction, Application, John D. Musa, Anthony Iannino,
Kazuhira Okumoto,(1987 )

WEB REFERNCES/MOOCS:
https://www.javatpoint.com/software-engineering-software-reliability
https://thechief.io/c/blameless/heres-your-complete-definition-software-reliability/
https://www.codingninjas.com/codestudio/library/software-reliability-measurement-techniques
THANK YOU

Team –Software Reliability

You might also like