Lecture 5 Flashcards
What is a control flow graph?
It is a graph which describes the sequence in which the different instructions of a program get executed.
What does an edge from one node to another represent in a CFG?
It represents the transfer of control between nodes
How do you draw a CFG?
By knowing the sequence, selection and iteration statements
What is a path?
It is a node and edge sequence from the starting node to a terminal node of the CFG. There can be more than one terminal node in a program.
What does path coverage testing require?
Coverage of the linearly independent paths
What is a linearly independent path?
Any path through the program that introduces at least one new edge that is not included in any other linearly independent paths.
Any path having a new node automatically implies that it has a new edge.
Is a path that is a sub path of another path linearly independent?
No
How do we determine the number of independent paths ?
By using McCabe’s cyclomatic complexity which finds the maximum number of linearly independent paths in a program. It doesn’t directly identify which paths or linearly independent but how many paths to look for and the minimum number of test cases required.
What is McCabe’s Cyclomatic Complexity formula?
Edges - Nodes + 2 (E - N + 2)
OR
Decision statements + 1 (P+1)
What steps should be followed for computing cyclomatic complexity and test cases design?
Construction of control flow graph (graph with nodes and edges from code)
Cyclomatic Complexity Calculation
Identification of the independent paths
Design of test cases
What does it mean if the complexity number is between 1 and 10?
The code is structured and well written, it has high testability and the cost and effort is less.
What does it mean if the complexity number is between 10 and 20?
The code is complex, it has medium testability and the cost and effort is medium
What does it mean if the complexity number is between 20 and 40?
The code is very complex, it has low testability and the cost and effort is high
What does it mean if the complexity number is over 40?
The code is not testable and it has very high cost and effort
What are the software quality product and process metrics?
Defect Density
Code Coverage
Mean Time To Failure
Mean Time to Repair
Test Case Effectiveness
Customer Satisfaction
Cycle Time
Code Complexity