|
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 Square Matrix

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.
Most Popular Articles on White Box Testing:
All about White Box Testing
Approaches to Code Complexity Testing - Cyclomatic Complexity
Comparison among Black Box & White Box Testing Techniques
Check Your Skills on White Box Testing - Through Descriptive Questions
Please click here - To read more Articles & Tutorials on White Box Testing
|
If you want to keep track of further articles on Software Testing, I suggest you to subscribe my RSS feed .
You can also Subscribe by E-mail and get All New articles delivered directly to your Inbox. | |
Comments :
Leave Your Comments: (*) Marked Fields are Mandatory