Path Testing

Profile picture for user devraj

If the test object includes loops or repetitions statement, branch or condition coverage is not sufficient for an adequate test. Path coverage requires the execution of all different path through the test object.

Path testing is an approach to testing where you ensure that every path through a program has been executed at least once. You normally use a dynamic analyzer tool or test coverage analyzer to check that all of the code in a program has been executed.

Usually loops repeats more than one time. A path describes the possible order of single program parts in a program fragment. The path consider dependencies between the branches, at which one branch leads back to the beginning of another branch.

The starting point for path testing is a program flow graph. This is a skeletal model of all paths through the program. A flow graph consists of nodes representing decisions and edges showing flow of control. The flow graph is constructed by replacing program control statements by equivalent diagrams. 

If there are no go to statements in a program, it is a simple process to derive its flow graph. Each branch in a conditional statement (if-then-else or case) is shown as a separate path. An arrow looping back to the condition node denotes a loop.

Path Testing Example

The following paths can be derived from the above given flow diagram:

Path 1: 1,2,3,6,7,8
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

Path Testing Techniques

Control Flow Graph (CFG)
Decision to Decision path (D-D) 
Independent (basis) paths

It is obvious that 100% path coverage in testing is not feasible for a nontrivial program.