Unit III – Chapter 3 Path Testing.

Slides:



Advertisements
Similar presentations
Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
Advertisements

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
Chapter 6 Path Testing Software Testing
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Lecture 11 Instructor Paulo Alencar.
1 Ivan Marsic Rutgers University LECTURE 15: Software Complexity Metrics.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
David Woo (dxw07u).  What is “White Box Testing”  Data Processing and Calculation Correctness Tests  Correctness Tests:  Path Coverage  Line Coverage.
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.
Chapter 18 Testing Conventional Applications
SOFTWARE TESTING WHITE BOX TESTING 1. GLASS BOX/WHITE BOX TESTING 2.
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.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
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.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
Path Testing + Coverage Chapter 9 Assigned reading from Binder.
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
1 Software Testing. 2 Path Testing 3 Structural Testing Also known as glass box, structural, clear box and white box testing. A software testing technique.
INTRUDUCTION TO SOFTWARE TESTING TECHNIQUES BY PRADEEP I.
White-box Testing.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
BASIS PATH TESTING.
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.
White Box Testing Arun Lakhotia University of Southwestern Louisiana P.O. Box Lafayette, LA 70504, USA
Overview Structural Testing Introduction – General Concepts
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:
Structural (White-Box) Testing Software Testing Module Dr. Samer Hanna.
White-Box Testing Techniques I Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture 7.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Software Testing. SE, Testing, Hans van Vliet, © Nasty question  Suppose you are being asked to lead the team to test the software that controls.
PREPARED BY G.VIJAYA KUMAR ASST.PROFESSOR
Software TestIng White box testing.
BASIS PATH TESTING.
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.
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Software Engineering (CSI 321)
Chapter 5 Decisions. Chapter 5 Decisions ssential uestion: How are Boolean expressions or operators used in everyday life?
Data Coverage and Code Coverage
Structural testing, Path Testing
White-Box Testing Techniques
Types of Testing Visit to more Learning Resources.
White Box Testing.
White-Box Testing.
CHAPTER 4 Test Design Techniques
Chapter 9 Path Testing–Part 1
White-Box Testing Techniques III
Software Testing (Lecture 11-a)
White-Box Testing.
White-Box Testing Techniques III
Structural Coverage.
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
White-Box Testing Techniques I
Control Structure Testing
Structural Coverage.
Whitebox Testing.
By: Lecturer Raoof Talal
Presentation transcript:

Unit III – Chapter 3 Path Testing

What is Path Testing? Path testing is a structural testing method that involves using the source code of a program in order to find every possible executable path. It helps to determine all faults lying within a piece of code. Any software program includes, multiple entry and exit points. Testing each of these points is a challenging as well as time-consuming. In order to reduce the redundant tests and to achieve maximum test coverage, basis path testing is used.

In the above example, we can see there are few conditional statements that is executed depending on what condition it suffice. Here there are 3 paths or condition that need to be tested to get the output, Path 1: 1,2,3,5,6, 7 Path 2: 1,2,4,5,6, 7 Path 3: 1, 6, 7

Advantages of Basic Path Testing It helps to reduce the redundant tests It focuses attention on program logic It helps facilitates analytical versus arbitrary case design Test cases which exercise basis set will execute every statement in a program at least once

Notations 1) To indicate a Sequence:

2) To indicate IF THEN ELSE:

3) To indicate a WHILE Loop:

4) To indicate a Repeat Until Loop:

5) To indicate a SWITCH Statement:

6) To indicate a Post Test FOR Loop:

7) To indicate Pre Test FOR Loop:

DD-Path A decision-to-decision path (DD-Path) is a path chain in a program graph such that: Initial and terminal nodes are distinct Every interior node has indeg =1 and outdeg = 1 The initial node is 2-connected to every other node in the path.

A decision-to-decision path (DD-Path) is a chain in a program graph such that: Case 1: consists of a single node with indeg=0 Case 2: consists of a single node with outdeg=0 Case 3: consists of a single node with indeg ≥ 2 or outdeg ≥ 2 Case 4: consists of a single node with indeg =1, and outdeg = 1 Case 5: it is a maximal chain of length ≥ 1

What is Code coverage? Code coverage is a measure which describes the degree of which the source code of the program has been tested. It is one form of white box testing which finds the areas of the program not exercised by a set of test cases. It also creates some test cases to increase coverage and determining a quantitative measure of code coverage.

Why use Code Coverage? Here, are some prime reasons for using code coverage: It helps you to measure the efficiency of test implementation It offers a quantitative measurement. It defines the degree to which the source code has been tested.

Statement Coverage Statement coverage is a white box test design technique which involves execution of all the executable statements in the source code at least once. It is used to calculate and measure the number of statements in the source code which can be executed given the requirements.

Example

The statements marked in yellow color are those which are executed as per the scenario Number of executed statements = 5, Total number of statements = 7 Statement Coverage: 5/7 = 71%

What is covered by Statement Coverage? Unused Statements Dead Code Unused Branches

Decision Coverage Decision coverage reports the true or false outcomes of each Boolean expression. In this coverage, expressions can sometimes get complicated. Therefore, it is very hard to achieve 100% coverage.

Example of decision coverage

Scenario 1: Value of a is 2 The code highlighted in yellow will be executed. Here the "No" outcome of the decision If (a>5) is checked. Decision Coverage = 50%

Scenario 2: Value of a is 6

The code highlighted in yellow will be executed The code highlighted in yellow will be executed. Here the "Yes" outcome of the decision If (a>5) is checked. Decision Coverage = 50% Test Case Value of A Output Decision Coverage 1 2 50% 6 18

Branch Coverage In the branch coverage, every outcome from a code module is tested. For example, if the outcomes are binary, you need to test both True and False outcomes. It helps you to ensure that every possible branch from each decision condition is executed at least a single time.

Example of Branch Coverage

Test Case Value of A Output Decision Coverage Branch Coverage 1 2 50% 33% 6 18 67%

Condition Coverage Conditional coverage or expression coverage will reveal how the variables or sub expressions in the conditional statement are evaluated. In this coverage expressions with logical operands are only considered. For example, if an expression has Boolean operations like AND, OR, XOR, which indicated total possibilities.

Example: For the below expression, we have 4 possible combinations TT FF TF FT

X=3 Y=4 (x<y) TRUE Condition Coverage is ¼ = 25% A=3 B=4 (a>b) FALSE

What is Cyclomatic Complexity? Cyclomatic complexity is a software metric used to measure the complexity of a program. These metric, measures independent paths through program source code. Independent path is defined as a path that has at least one edge which has not been traversed before in any other paths. Cyclomatic complexity can be calculated with respect to functions, modules, methods or classes within a program.

How to Calculate Cyclomatic Complexity Mathematical representation: V(G) = E - N + 2Where, E - Number of edges N - Number of Nodes V (G) = P + 1 Where P = Number of predicate nodes (node that contains condition)

Computing mathematically, V(G) = 9 - 7 + 2 = 4 V(G) = 3 + 1 = 4 (Condition nodes are 1,2 and 3 nodes) Basis Set - A set of possible execution path of a program 1, 7 1, 2, 6, 1, 7 1, 2, 3, 4, 5, 2, 6, 1, 7 1, 2, 3, 5, 2, 6, 1, 7