This post is in continuation with WHITE BOX TESTING PART ONE and basics.
Cyclomatic Complexity:
The Cyclomatic complexity gives a quantitative measure of the logical complexity.
This value gives the number of independent paths in the Basis set, and an upper bound for the number of tests to ensure that each statement is executed at least once. An independent path is any path through a program that introduces at least one new set of processing statements or a new condition (i.e., a new edge).
Cyclomatic complexity (CC) = E - N + p
Where
E = the number of edges of the graph
N = the number of nodes of the graph
p = the number of connected components
Example has:

Cyclomatic complexity of 4.
Independent paths:
1. 1, 8
2. 1, 2, 3, 7b, 1, 8
3. 1, 2, 4, 5, 7a, 7b, 1, 8
4. 1, 2, 4, 6, 7a, 7b, 1, 8
Cyclomatic complexity provides upper bound for number of tests required to guarantee overage
of all program statements. As one of the more widely-accepted software metrics, it is intended to
be independent of language and language format.
Deriving Test Cases
1. Using the design or code, draw the corresponding flow graph.
2. Determine the Cyclomatic complexity of the flow graph.
3. Determine a basis set of independent paths.
4. Prepare test cases that will force execution of each path in the basis set.
30
Cyclomatic Complexity:
The Cyclomatic complexity gives a quantitative measure of the logical complexity.
This value gives the number of independent paths in the Basis set, and an upper bound for the number of tests to ensure that each statement is executed at least once. An independent path is any path through a program that introduces at least one new set of processing statements or a new condition (i.e., a new edge).
Cyclomatic complexity (CC) = E - N + p
Where
E = the number of edges of the graph
N = the number of nodes of the graph
p = the number of connected components
Example has:

Cyclomatic complexity of 4.
Independent paths:
1. 1, 8
2. 1, 2, 3, 7b, 1, 8
3. 1, 2, 4, 5, 7a, 7b, 1, 8
4. 1, 2, 4, 6, 7a, 7b, 1, 8
Cyclomatic complexity provides upper bound for number of tests required to guarantee overage
of all program statements. As one of the more widely-accepted software metrics, it is intended to
be independent of language and language format.
Deriving Test Cases
1. Using the design or code, draw the corresponding flow graph.
2. Determine the Cyclomatic complexity of the flow graph.
3. Determine a basis set of independent paths.
4. Prepare test cases that will force execution of each path in the basis set.
30

0 comments
Post a Comment