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
What is defect density?
This measures the number of defects found in a software product per unit of size (lines of code). It can be used to evaluate the quality of the product and to identify areas for improvement.
How do you calculate defect density?
Total number of defects/ size of the software product (LOC)
What is code coverage?
The percentage of code that has been tested. It can be used to evaluate the thoroughness of testing and to identify areas of the code that haven’t been tested.
How do you calculate code coverage?
(No. LOC executed / Total LOC) * 100
What is mean time to failure?
The average time between failures of a software product. It can be used to evaluate the reliability of the product
How do you calculate mean time to failure?
Total operating time/No. of failures
What is mean time to repair?
The average time it takes to fix a defect in a software product. It can be used to evaluate the efficiency of the development process.
How do you calculate mean time to repair?
Total downtime/ No. of repairs to restore operation
What is test case effectiveness?
The percentage of test cases that detect defects. It can be used to evaluate the effectiveness of the testing process.