Path testing is a kind of structural testing technology which find out all the possible paths through the control flow of the program. Path testing is a white box testing technique which evaluates the internal flow of the system.
This testing technique is the oldest testing technique which is most widely used for the new software usually for unit testing. As path testing is a white box testing method, it is based on the source code, internal working of the system and do not depend upon the specifications of the system.
Path testing states that each and every paths in the program should be executed atleast once. The number of paths to be tested is calculated depending upon the cyclomatic complexity and it generates the test cases for each path to be executed.
There are basically three types of path testing techniques:
1. Control Flow Graph
2.Decision to Decision path
3. Independent path
1. Control Flow Graph (CFG): Control flow graph is the starting point of path testing. The source code is represented in the form of nodes and edges.
2.Decision to decision path (D-D): The control flow graph can be divided into small decisions path which leads to individual path.
3.Independent path: Independent path is a path which can be derived only through the decision path and not from the any other methods.
Let us consider one example of path testing as follows:
The following paths can be derived from the above given flow diagram. The paths are as follows:
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
Advantages of path testing:
- It focuses more on the program logic.
- Path testing is dependent on the source code.
- The flow of the program is analyzed
Disadvantages of path testing:
- Expert testers are required.
- It’s not possible to test all the paths.