Path Analysis Why path analysis for test case design?

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,
1 D. R. Wilton ECE Dept. ECE 6382 Introduction to Linear Vector Spaces Reference: D.G. Dudley, “Mathematical Foundations for Electromagnetic Theory,” IEEE.
Chapter 6 Path Testing Software Testing
Whitebox Testing Fra: CS Fall Whitebox Testing AKA Structural, Basis Path Test Normally used at unit level Assumes errors at unit level are.
White Box and Black Box Testing Tor Stålhane. What is White Box testing White box testing is testing where we use the info available from the code of.
Control Flow Analysis. Construct representations for the structure of flow-of-control of programs Control flow graphs represent the structure of flow-of-control.
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.
Creator: ACSession No: 13 Slide No: 1Reviewer: SS CSE300Advanced Software EngineeringFebruary 2006 Testing - Techniques CSE300 Advanced Software Engineering.
Software engineering for real-time systems
Binary Decision Diagrams1 BINARY DECISION DIAGRAMS.
IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16.
Pipe Network  Pipe network is analyzed based on: 1. Conservation of mass 2. Conservation of energy.
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.
Path testing Path testing is a “design structural testing” in that it is based on detailed design & the source code of the program to be tested. The methodology.
A Complexity Measure THOMAS J. McCABE Presented by Sarochapol Rattanasopinswat.
Cyclomatic Complexity Dan Fleck Fall 2009 Dan Fleck Fall 2009.
ECE355 Fall 2004Software Reliability1 ECE-355 Tutorial Jie Lian.
Software Systems Verification and Validation Laboratory Assignment 3
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Lecture 9 Instructor Paulo Alencar.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Testing phases. Test data Inputs which have been devised to test the system Test cases Inputs to test the system and the predicted outputs from these.
White-Box Testing Eshcar Hillel Michael Beder. White Box Testing 2 Tutorial Outline What is White Box Testing? Flow Graph and Coverage Types Symbolic.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
CSC 480 Software Engineering Lecture 14 Oct 16, 2002.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
Reference Paulo Alencar, University of Waterloo Frank Tsui, Southern Polytechnic State University.
Agenda Introduction Overview of White-box testing Basis path testing
Lec 06 Path Testing Part II - 1 CSCE 747 Fall 2013 CSCE 747 Software Testing and Quality Assurance Lecture 06 – Path Testing Part II 9/16/
White-box Testing.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
BASIS PATH TESTING.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
Creator: ACSession No: 7 Slide No: 1Reviewer: SS CSE300Advanced Software EngineeringSeptember 2005 Software Measurement – Estimation and Productivity CSE300.
White Box and Black Box Testing
CSC 480 Software Engineering Testing - I. Plan project Integrate & test system Analyze requirements Design Maintain Test units Implement Software Engineering.
Chapter 8 Path Testing. Path testing Path testing is a “design structural testing” in that it is based on detailed design & the source code of the program.
1 Control Flow Analysis Topic today Representation and Analysis Paper (Sections 1, 2) For next class: Read Representation and Analysis Paper (Section 3)
White Box Testing Arun Lakhotia University of Southwestern Louisiana P.O. Box Lafayette, LA 70504, USA
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.
Cyclomatic complexity (or conditional complexity) is a software metric (measurement). Its gives the number of indepented paths through strongly connected.
Cyclomatic Complexity Philippe CHARMAN Last update:
White-Box Testing Techniques I Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture 7.
Software Testing. SE, Testing, Hans van Vliet, © Nasty question  Suppose you are being asked to lead the team to test the software that controls.
Structure Based Test Design
BASIS PATH 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)
Path testing Path testing is a “design structural testing” in that it is based on detailed design & the source code of the program to be tested. The.
Structural testing, Path Testing
Constructing and Using
Software Testing (Lecture 11-a)
Software Engineering Lecture #39
Solution to problem 4. a) Control flow graph art Start k = i + 2 * j
White-Box Testing Techniques I
1. Cyclomatic complexity
By: Lecturer Raoof Talal
Unit III – Chapter 3 Path Testing.
Presentation transcript:

Path Analysis Why path analysis for test case design? Provides a systematic methodology. Reproducible Traceable Countable What is path analysis? Analyzes the number of paths that exist in the system Facilitates the decision process of how many paths to include in the test

Linearly Independent Path A path through the system is Linearly Independent** from other paths only if it includes some segment that is not covered in the other path. S1 - The statements are represented by the rectangular and diamond blocks. - The segments between the blocks are labeled with numbered circles. 1 2 C1 Path1 : S1 – C1 – S3 Path2 : S1 – C1 – S2 – S3 OR Path1: segments (1,4) Path2: segments (1,2,3) 4 S2 3 S3 Path1 and Path2 are linearly independent because each includes some segment that is not included in the other. ** This definition will require more explanation later.

Another Example of Linearly Independent Paths 1 S2 8 C1 2 Path1: segments (1,2,8) Path2: segments (1,5,3,9) Path3: segments (1,5,6,4,10) Path4: segments (1,5,6,7) Note that these are all linearly independent 5 C2 3 S3 9 6 C3 4 10 S4 7 S5

Statement Coverage Method Count all the linearly independent paths Pick the minimum number of linearly independent paths that will include all the statements (S’s and C’s in the diagram) S1 Path1 : S1 – C1 – S3 Path2 : S1 – C1 – S2 – S3 1 2 C1 4 S2 3 S3 Path1 and Path2 are needed to cover all the statements: (S1,C1,S2,S3) ?

Another Example of Statement Coverage 1 S2 8 C1 2 The 4 Linearly Independent Paths Covers: Path1: includes S1-C1-S2-S5 Path2: includes S1-C1-C2-S3-S5 Path3: includes S1-C1-C2-C3-S4-S5 Path4: includes S1-C1-C2-C3-S5 5 C2 3 S3 9 6 C3 4 10 S4 7 S5 For 100% Statement Coverage, all we need are 3 paths : Path1, Path2, and Path3 to cover all the statements (S1,C1,S2,C2,S3,C3,S4,S5) - - - no need for Path4 - - - -

Branch Coverage Method Identify all the decisions Count all the branches from the each of the decisions Pick the minimum number of paths that will cover all the branches from the decisions.

Branch Coverage Method S1 Decision C1 : B1 : Path1 : C1 – S3 B2 : Path2 : C1 – S2 – S3 1 Branch 1 C1 Branch 2 2 4 S2 3 S3 Path1 and Path2 are needed to cover both branches from C1?

Another Example of Branch Coverage The 3 Decisions: C1: - B1 : C1- S2 - B2 : C1- C2 C2: - B3 : C2 – S3 - B4 : C2 – C3 C3: - B5 : C3 – S4 - B6 ; C3 – S5 S1 1 S2 8 C1 2 5 C2 3 S3 9 6 C3 4 10 S4 The 4 Linearly Independent Paths Covers: Path1: includes S1-C1-S2-S5 Path2: includes S1-C1-C2-S3-S5 Path3: includes S1-C1-C2-C3-S4-S5 Path4: includes S1-C1-C2-C3-S5 7 S5 We need: Path1 to cover B1, Path2 to cover B2 and B3, Path3 to cover B4 and B5, Path4 to cover B6

McCabe’s Cyclomatic Number Is there a way to know how many linearly independent paths exist? McCabe’s Cyclomatic number used to study program complexity may be applied. There are 3 ways to get the Cyclomatic Complexity number from a flow diagram. # of binary decisions + 1 # of edges - # of nodes + 2 # of closed regions + 1 Reference: T.J. McCabe, “A complexity Measure,” IEEE Transactions on Software Engineering, Dec. 1976

McCabe’s Cyclomatic Complexity Number Earlier Example We know there are 2 linearly independent paths from before: Path1 : C1 – S3 Path2 : C1 – S2 – S3 S1 1 McCabe’s Cyclomatic Number: a) # of binary decisions +1 = 1 +1 = 2 b) # of edges - # of nodes +2 = 4-4+2 = 2 c) # of closed regions + 1 = 1 + 1 = 2 C1 2 4 Closed region S2 3 S3

McCabe’s Cyclomatic Complexity Number Another Example McCabe’s Cyclomatic Number: a) # of binary decisions +1 = 2 +1 = 3 b) # of edges - # of nodes +2 = 7-6+2 = 3 c) # of closed regions + 1 = 2 + 1 = 3 S1 1 4 C1 2 C2 5 S2 There are 3 Linearly Independent Paths Closed Region Closed Region S4 7 6 3 S3

An example of 2n total path Since for each binary decision, there are 2 paths and there are 3 in sequence, there are 23 = 8 total “logical” paths path1 : S1-C1-S2-C2-C3-S4 path2 : S1-C1-S2-C2-C3-S5 path3 : S1-C1-S2-C2-S3-C3-S4 path4 : S1-C1-S2-C2-S3-C3-S5 path5 : S1-C1-C2-C3-S4 path6 : S1-C1-C2-C3-S5 path7 : S1-C1-C2-S3-C3-S4 path8 : S1-C1-C2-S3-C3-S5 S1 1 C1 2 3 S2 4 C2 5 6 S3 How many Linearly Independent paths are there? Using Cyclomatic number = 3 decisions +1 = 4 One set would be: path1 : includes segments (1,2,4,6,9) path2 : includes segments (1,2,4,6,8) path3 : includes segments (1,2,4,5,7,9) path5 : includes segments (1,3,6,9) 7 C3 9 8 S5 S4 Note 1: with just 2 paths ( Path1 and Path8) all the statements are covered. Note2: with just 2 paths ( Path1 and Path8) all the branches are covered.

Example with a Loop Total number of paths may be “ infinite” (very large) because of the loop S1 1 Linearly Independent Paths = 1 decision +1 = 2 path1 : S1-C1-S3 (segments 1,4) path2 : S1-C1-S2-C1-S3 (segments 1,2,3,4) C1 4 S3 2 One path will cover all statements: (S1,C1,S2, S3) path2 : S1-C1-S2-C1-S3 S2 3 One path will cover all branches: path2 : S1-C1-S2-C1-S3 branch1 (C1-S2) and branch 2 (C1-S3)

More on Linearly Independent Paths In discussing dimensionality, we talks about orthogonal vectors. Two dimensional space has two orthogonal vector from which all the other vectors in two dimension can be obtained via “linear combination” of these vectors: [1,0] [0,1] e.g. [2,4] = 2[1,0] + 4[0,1] [2,4] [1,0] [0,1]

More on Linearly Independent Paths A set of paths is considered to be a Linearly Independent Set if every path may be constructed as a “linear combination” of paths from the linearly independent set. For example: We already know: a) there are a total of 22=4 logical paths. b) 2 paths that will cover all statements and all branches. c) 2 branches +1 = 3 linearly independent paths. C1 2 1 S1 1 2 3 4 5 6 3 We picked path1, path2 and path3 as The Linearly Independent Set path1 1 1 1 C2 5 path2 1 1 4 path3 1 1 1 S1 path4 1 1 1 1 6 path 4 = path3 + path1 – path2 = (0,1,1,1,0,0)+(1,0,0,0,1,1)- (1,0,0,1,0,0) = (1,1,1,1,1,1) - (1,0,0,1,0,0) = (0,1,1,0,1,1)

More on Linearly Independent Paths We already know: a) there are a total of 22=4 logical paths. b) 2 paths that will cover all statements and all branches. c) 2 branches +1 = 3 linearly independent paths. C1 2 1 S1 1 2 3 4 5 6 3 path1 1 1 1 C2 5 path2 1 1 4 path3 1 1 1 S1 path4 1 1 1 1 6 Although path1 and path3 are linearly independent, they do NOT form a Linearly Independent Set because no linear combination of path1 and path3 can get , say, path4.

More on Linearly Independent Paths Because the Linearly Independent Set of paths display the same characteristics as the mathematical concept of basis in n-dimensional vector space, the testing using the Linearly Independent Set of paths is sometimes called the “basis” testing.

Paths Analysis Interested in Total number of “logical” paths Interested in Linearly Independent paths Interest in Branch coverage Interested in Statement coverage Which one is the largest set, next largest set, - - - , etc.?