Cyclomatic complexity (or conditional complexity) is a software metric (measurement). Its gives the number of indepented paths through strongly connected.

Slides:



Advertisements
Similar presentations
Software Testing Techniques
Advertisements

Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
Software Testing Technique. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves.
Chapter 14 Testing Tactics
Path Analysis Why path analysis for test case design?
Chapter 6 Path Testing Software Testing
1 Ivan Marsic Rutgers University LECTURE 15: Software Complexity Metrics.
CYCLOMATIC COMPLEXITY 1. Invented by Thomas McCabe (1974) to measure the complexity of a program ’ s conditional logic Cyclomatic complexity of graph.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
-- Finishing Design Unit -- Intro to Glass Box Testing ECEN5543 / CSCI 5548 SW Eng of Standalone Programs University of Colorado, Boulder.
David Woo (dxw07u).  What is “White Box Testing”  Data Processing and Calculation Correctness Tests  Correctness Tests:  Path Coverage  Line Coverage.
1 Static Analysis Methods CSSE 376 Software Quality Assurance Rose-Hulman Institute of Technology March 20, 2007.
Software engineering for real-time systems
White Box Testing Techniques Dynamic Testing. White box testing(1) Source code is known and used for test design While executing the test cases, the internal.
BASIS PATH TESTING ● By Tom McCabe ● McCabe, T., "A Software Complexity Measure," IEEE Trans. Software Engineering, vol. SE-2, December 1976, pp
Chapter 18 Testing Conventional Applications
Unit Testing CS 414 – Software Engineering I Don Bagert Rose-Hulman Institute of Technology January 16, 2003.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
1 The Relationship of Cyclomatic Complexity, Essential Complexity and Error Rates Mike Chapman and Dan Solomon
A Complexity Measure THOMAS J. McCABE Presented by Sarochapol Rattanasopinswat.
Cyclomatic Complexity Dan Fleck Fall 2009 Dan Fleck Fall 2009.
Software Systems Verification and Validation Laboratory Assignment 3
Distance Approximating Trees in Graphs
CMSC 345 Fall 2000 Unit Testing. The testing process.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
Software Testing Testing types Testing strategy Testing principles.
Software Testing The process of operating a system or component under specified conditions, observing and recording the results, and making an evaluation.
Agenda Introduction Overview of White-box testing Basis path testing
Software Quality Metrics
INTRUDUCTION TO SOFTWARE TESTING TECHNIQUES BY PRADEEP I.
Software Testing and Reliability Southern Methodist University CSE 7314.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
BASIS PATH TESTING.
Creator: ACSession No: 7 Slide No: 1Reviewer: SS CSE300Advanced Software EngineeringSeptember 2005 Software Measurement – Estimation and Productivity CSE300.
Software Testing White Box Testing. Agenda What is White Box Testing Correctness Tests and Path Coverage Correctness Tests and Line Coverage McCabe Cyclomatic.
1 Ivan Marsic Rutgers University LECTURE 15: Software Complexity Metrics.
Theory and Practice of Software Testing
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Agent program is the one part(class)of Othello program. How many test cases do you have to test? Reversi [Othello]
White Box Testing by : Andika Bayu H.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Cyclomatic Complexity Philippe CHARMAN Last update:
Software Testing Techniques Presented By Dr. Shazzad Hosain.
CS223: Software Engineering Lecture 21: Unit Testing Metric.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
CHAPTER 9 - PART 2 Software Testing Strategies. Lesson Outlines ■ White box testing – Data processing and calculation correctness tests – Correctness.
Software Test Metrics When you can measure what you are speaking about and express it in numbers, you know something about it; but when you cannot measure,
Software Engineering (CSI 321)
BASIS PATH TESTING.
Cyclomatic Complexity
Software Testing.
White-Box Testing Pfleeger, S. Software Engineering Theory and Practice 2nd Edition. Prentice Hall, Ghezzi, C. et al., Fundamentals of Software Engineering.
Software Testing.
Cyclomatic complexity
Software Engineering (CSI 321)
Structural testing, Path Testing
White Box Testing.
Celia Chen1, Lin Shi2, Kamonphop Srisopha1
Cyclomatic Complexity
Cyclomatic Complexity
Software Testing (Lecture 11-a)
Cyclomatic Complexity
LECTURE 15: Software Complexity Metrics
Halstead software science measures and other metrics for source code
Cyclomatic Complexity
Cyclomatic Complexity
Software Metrics SAD ::: Fall 2015 Sabbir Muhammad Saleh.
1. Cyclomatic complexity
By: Lecturer Raoof Talal
Unit III – Chapter 3 Path Testing.
Presentation transcript:

Cyclomatic complexity (or conditional complexity) is a software metric (measurement). Its gives the number of indepented paths through strongly connected directed graphs. It directly measures the number of linearly independent paths through a program's source code.

Cyclomatic complexity is computed using the control flow graph of the program which contains node, edges, unconnected part of graph. Cyclometic complexity can b used for following: To find the number of paths to look for basis path testing. To indicate a unit testability, understandability and maintainability. To indicate the effort required to test a unit

Complex modules are harder to understand. Such modules are: more prone to errors, hard to test and are harder to modify. Cyclomatic Complexity calculation helps to decide whether the module under test consideration is overly complex or is well written. Hence, during Code-based Testing, testers shall arrive at Cyclomatic Complexity of each programming module, based on the value of it.

 If value of Cyclomatic Complexity is more than 10, the structure of the module is overly complex.  If value of Cyclomatic Complexity is more than 5 and less than 10, the structure of the module is complex indicating that the logic is difficult to test  If value of Cyclomatic Complexity is less than 5, the structure of the module is simple indicating that the logic is easy to test. 5

Paths in Graphs (1)  A graph is strongly connected if for any two nodes x, y there is a path from x to y and vice versa  A path is represented as an n-element vector where n is the number of edges  The i-th position in the vector is the number of occurrences of edge i in the path 6

A strongly connected graph. This graph has 10 edges, 8 nodes

Linearly Independent Paths  A path p is said to be a linear combination of paths p 1, …, p n if there are integers a 1, …, a n such that p =  a i  p i  A set of paths is linearly independent if no path in the set is a linear combination of any other paths in the set  A basis set of cycles is a maximal linearly independent set of cycles In a graph with e edges and n nodes, the basis has e  n + 1 cycles  Every path is a linear combination of basis cycles 8

Arriving at Cyclomatic Complexity

Step 2: Count number of nodes in flow graph, n Step 3: Count number of edges in flow graph, e Step 4: Determine Cyclomatic complexity, V(g) = e-n+2 Step 5: Determine a basis set of linearly independent paths. Step 6: Prepare test cases that will force execution of each path in the basis set.

Step 1: Flow Graph Representation

Step 2: Cyclomatic Complexity Calculation Number of nodes, n= 15 Number of Edges, e= 13 Cyclomatic Complexity, V (g) = e – n + 2 = 15 – = 4

Thank you :