
Software Testing - Path Testing
Software testing consists of two primary steps namely test case design, and test case execution. The test case design phase is driven by the preparation of the test plan, and test strategy. The software path testing is one of the methods used for designing the test cases.
What is Software Path Testing?
The software path testing is an approach taken up for test case preparation. In this technique, the control flow graph of the program source code is generated to calculate a set of linearly independent paths. Also the cyclomatic complexity of the code is measured to get the count of the linearly independent paths, and finally the test cases are created from each of the paths.
The software path testing is used to obtain the complete branch coverage of the code but it is done without touching every possible path of the control flow graph. The cyclomatic complexity of the code guides the software path testing process.
Process of Software Path Testing
The process of the software path testing are listed below −
Step 1 − Create the control flow graph of the program source code where all the executable paths are to be identified.
Let us consider the below block of code.
IF K = 580 THEN IF L > M THEN K = L ELSE K = M END IF END IF PRINT K
The control flow graph for the code is shown below −

Step 2 − Calculate the cyclomatic complexity of the same code by using the below formula −
The cyclomatic complexity represented by V(G) = E - N + 2 * P. Here, E is the total count of edges, N is the total count of nodes, and P is the total count of connected components in the graph.
In the control flow graph shown in the step1, there are seven nodes(N) represented by blue circles. Please note, the total count of lines of the code is equal to the total count of nodes. There are eight edges(E) represented in red, and since there is only one method, the total count of connected components(P) in the graph is 1. Thus as per the formula,
V(G) = E - N + 2 * P = 8 - 7 + 2 * 1 = 3.
Step 3 − Create a set of all the paths as per the control flow graph, the cardinality of the set is equal to the measured cyclomatic complexity.
Step 4 − Develop a test case for each path of the set calculated in the above step.
What are the Techniques of Software Path Testing?
The techniques for the software path testing are listed below −
- Control Flow Graph − The complete block of code is converted into a control flow graph with the help of the nodes, and edges.
- Decision to Decision Paths − The control flow graph is split into multiple Decision to Decision Paths and finally combined into specific nodes.
- Independent Paths − An independent path is a path coming from the Decision to Decision path graph that cannot be generated from other paths using different methods.
Advantages of Software Path Testing
The advantages of the software path testing are listed below −
- The software path testing prevents the creation of redundant test cases.
- The software path testing validates the logic of the program source code.
- The software path testing is an effective, and productive test case design technique.
Disadvantages of Software Path Testing
The disadvantages of the software path testing are listed below −
- The testers involved with the software path testing should be experienced, and should have technical skill and programming knowledge.
- As the count of the test cases increases as the complexity the program source code is increased.
- It is difficult to come up with a test path if the complication of the source code is very high.
- Some of the test paths may not consider every condition given in the program source code.
Conclusion
This concludes our comprehensive take on the tutorial on Software Path Testing. Weve started with describing what is software path testing, what is the process of the software path testing, what are the techniques of the software path testing, what are the advantages of the software path testing, and what are the disadvantages of the software path testing. This equips you with in-depth knowledge of Software Path Testing. It is wise to keep practicing what youve learned and exploring others relevant to Software Testing to deepen your understanding and expand your horizons.