Tutorial-8: Understanding the Basics of Graph Matrix Based Software Testing
In graph matrix based testing, we convert Our flow graph into a square matrix with one row and one column for every node in the graph. If the size of graph increases, it becomes difficult to do path tracing manually.
Objective of the Tutorial: To trace all links of the Flow Graph at least once, draw a Square Matrix from it & find out the cyclomatic complexity, V(G) and hence the independent paths.
Process of constructing the Square Matrix leading to computation of Cyclomatic Complexity goes like this:
Step 1: Start from the following basic Flow Graph as an example of an input
Step 2: Construct its corresponding
Step 3: Let us consider another Flow Graph as an example
Step 4: Construct its corresponding Square Matrix
It may be noted that if there are several links between two nodes then ” + ” sign denotes a parallel link.
This is, however, not very useful. Hence we assign a weight to each entry of the graph matrix.
We use ‘1’ to denote that the edge is present and ‘0’ to indicate its absence. Such a matrix is known as a connection matrix.
For above figure connection matrix can be shown as under.
Step 5: Compute it’s V(G) & draw the matrix again for the same
i.e., we sum each row of the above matrix. Then, we subtract “1” from each row. We, then, add this result or column of result and add “1” to it.
This gives us V(G).
For above matrix we get V(G) = 2.
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.