There is another property of graphs that has deep implications for testing: cyclomatic complexity. DefinitionThe cyclomatic number of a graph G is given by V(G) = e - n + p, where:• e is the number of edges in G, • n is the number of nodes in G, and • p is the number of components in G. V(G) is the number of distinct regions in a graph. One formulation of structural testing postulates the notion of basis paths in a program, from which all other paths can be derived, and shows that the cyclomatic number of the program graph (see the end of this chapter) is the number of these basis elements. The cyclomatic number of our example graph is V(G) = 5 - 7 + 2 = 0. When we use cyclomatic complexity in testing, we will (usually) have strongly connected graphs; this will generate graphs with larger cyclomatic complexity.
đang được dịch, vui lòng đợi..