Download presentation
Presentation is loading. Please wait.
Published byRegan Bowyer Modified over 9 years ago
1
Path Testing Basics By Chandra Kumar R Date : 20-Nov-2004
2
Objective To understand the basic concepts of Path Testing Techniques. To understand the basic concepts of Path Testing Techniques. To know the use of flow graphs in path testing. To know the use of flow graphs in path testing. To get idea for doing the effective testing using the path testing techniques. To get idea for doing the effective testing using the path testing techniques.
3
Sequence of Presentation Basic Path testing Concepts. Basic Path testing Concepts. Program flow graph. Program flow graph. Cyclomatic complexity. Cyclomatic complexity. Flow graph Vs Flow chart. Flow graph Vs Flow chart. Procedure for path testing. Procedure for path testing. Complete testing. Complete testing. Path testing Criteria. Path testing Criteria. Path selection. Path selection.
4
Presentation Duration Estimated Time : ~ 45 Minutes Estimated Time : ~ 45 Minutes Presentation : ~ 30 Minutes Presentation : ~ 30 Minutes Queries : ~ 15 Minutes Queries : ~ 15 Minutes
5
Test based on selecting sets of test paths through the program.Test based on selecting sets of test paths through the program. Requires complete knowledge of program's structure.Requires complete knowledge of program's structure. Applicable to new software for Unit testing.Applicable to new software for Unit testing. Aim is to make sure all the paths are executed.Aim is to make sure all the paths are executed. Basic Path testing Concepts
6
Describes the program control flow.Describes the program control flow. Any procedural design can be translated into a flow graph.Any procedural design can be translated into a flow graph. Used as a basis for test data selection.Used as a basis for test data selection. Used to derive a logical complexity measure of a procedural design.Used to derive a logical complexity measure of a procedural design. Program flow graph
7
Flow graph Elements Process/nodeDecision whileuntilsequenceifcase Junction
8
1.while( counter >= 0 ) { counter-- ; counter-- ; 2. if(EmpNo < 150 ) 3. { 4. if( Exp < 2 ) { printf( “……” ) ; printf( “……” ) ; } 5. else { printf( “……” ) ; printf( “……” ) ; } 7a. } 6. else { printf( “ Invalid Number “ ) ; printf( “ Invalid Number “ ) ; 7b. } 8. } Flow graph Example 1 2 7b7b 8 6 3 4 5 7a7a
9
Number of tests to test all control statements equals the cyclomatic complexityNumber of tests to test all control statements equals the cyclomatic complexity Gives the number of independent paths in the basis set.Gives the number of independent paths in the basis set. Provides upper bound for the number of tests required.Provides upper bound for the number of tests required. Guarantees for the coverage of all program statements.Guarantees for the coverage of all program statements. Cyclomatic complexity
10
Flow graph Vs Flow chart Flow graph Flow chart Flow graph compacts the representation. Flow graph clarifies the control flow and data flow issues. Flow chart resembles a control flow graph but too much informative. Flow Chart forces an expansion of visual complexity.
11
Derive a flow graph from the design or source code.Derive a flow graph from the design or source code. Determine the Cyclomatic complexity of this flow graph.Determine the Cyclomatic complexity of this flow graph. Determine a basis set of linearly independent paths.Determine a basis set of linearly independent paths. Prepare test cases that will force execution of each path in the basis set.Prepare test cases that will force execution of each path in the basis set. Procedure for path testing
12
Complete Testing Every path from entry to exit. Every path from entry to exit. Every statement or instruction at least once. Every statement or instruction at least once. Every branch/case statement, in each direction. Every branch/case statement, in each direction.
13
Continued… if ( x < 0 ) if ( x < 0 ) { goto aa ; goto aa ; } else else { x = x + 1; x = x + 1; } aa : x = x + 1; X < 0 x = x + 1 a Yes No Correct Version
14
Continued… if ( x < 0 ) if ( x < 0 ) { goto aa ; goto aa ; } aa : x = x + 1; Incorrect Version X < 0 a x = x + 1 Yes No Executing every statement, but not every branch would not reveal the defect in the above incorrect version.
15
Continued….. X < 0 x = x + 1 b Yes No a if ( x < 0 ) if ( x < 0 ) { goto bb ; goto bb ; } else else { x = x + 1; x = x + 1; goto bb ; goto bb ; } aa : x = x + 1; goto aa ; goto aa ; bb : x = x + 1; Hidden Loop Uncovered in branch coverage.
16
Path-Testing Criteria Path Testing. Path Testing. - 100% path coverage ( c1 + c2 ) Statement Testing. Statement Testing. - 100% statement coverage ( c1 ) Branch Testing. Branch Testing. - 100% branch coverage ( c2 )
17
Path Selection Enough paths should be selected to achieve ( c1 + c2 ). Enough paths should be selected to achieve ( c1 + c2 ). First take the most obvious path to the exit. First take the most obvious path to the exit. Select successive paths as small variations of previous paths. Select successive paths as small variations of previous paths. Take many simple paths than a few complicated paths. Take many simple paths than a few complicated paths.
18
Example 4 6 7 8 2531 NoYes Yes No abc ge h f i d EndStart PathsDecisionsProcess-Link abcdabfhedabfigbcd Yes Yes No Yes No Yes No, Yes No No, Yes No abcdefghi74
19
Continued… Check whether every decision has a Yes and No in its column. Check whether every decision has a Yes and No in its column. Check whether every case of all case statements has been marked. Check whether every case of all case statements has been marked. Check whether every three way branch is covered. Check whether every three way branch is covered. Check whether every link covered at least once. Check whether every link covered at least once.
20
Conclusion Path testing is used in the unit test phase. Path testing is used in the unit test phase. It gives some measure of test thoroughness which leads to defect free code. It gives some measure of test thoroughness which leads to defect free code.
21
References Software Testing Techniques by Boris Beizer, Second Edition, 3 rd Reprint : 2004, Page No : 59 to 80. Software Testing Techniques by Boris Beizer, Second Edition, 3 rd Reprint : 2004, Page No : 59 to 80. www.mathematik.uni- ulm.de/sai/melzer/thesis/node1.html. www.mathematik.uni- ulm.de/sai/melzer/thesis/node1.html. www.softwaretesting.nildram.co.uk/cont 381.htm. www.softwaretesting.nildram.co.uk/cont 381.htm.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.