Test Case Coverage Analysis Assignment Answers
Your question:
Assignment Help Answers with Step-by-Step Explanation:
THEN
C = A - B
IF C = D
Then Print "Error"
To achieve full branch coverage, you need to cover both the true and false branches for each decision point (if statement). In this code, there's one decision point at `IF A > B`. You would need a minimum of 2 test cases to cover both branches (true and false).
4. Full Path Coverage:
5. Cyclomatic Complexity Matrix:
The cyclomatic complexity of a program can be calculated using the formula:
- E is the number of edges in the flow graph.
- N is the number of nodes in the flow graph.
The basis set of independent paths represents a set of linearly independent paths through the code. To determine this, you can list the paths, ensuring that no path in the set is a linear combination of others. For this code, the basis set of independent paths includes the following two paths:
- Path 1: A > B (True) -> C = A - B -> Read D -> C = D (False)
- Test Case 2: Set A > B to false, and make sure C != D.
These test cases should cover all the paths and ensure you achieve full path coverage, as well as coverage for the basis set of independent paths.