Software Development and Project Management

For the decision 'A and B' (A and B are conditions whose truth values can be set independently), two test cases were run: (A = true, B = false) and (A = false, B = true). Which statement about coverage criteria is correct?

  1. ABranch coverage is achieved, but condition coverage is not
  2. BBoth branch coverage and condition coverage are achieved
  3. CCondition coverage is achieved, but branch coverage is not
Show answer and explanation

Answer: C. Condition coverage is achieved, but branch coverage is not

Condition coverage requires each individual condition in a decision (A and B) to take both true and false at least once. In the two test cases, A and B each take true and false once, so condition coverage is achieved. However, 'A and B' is false in both test cases, and the branch for a true decision is never taken, so branch coverage is not achieved. Because condition coverage alone does not guarantee branch coverage, criteria that satisfy both, such as decision/condition coverage, are used. Note that this reasoning uses the values given to each condition; with short-circuit evaluation, as with && in C, where the right side is not evaluated when the left side is false, one may instead count only the conditions actually evaluated.

  • A. The decision is false in both test cases, so branch coverage is not achieved.
  • B. No test case makes the decision true, so branch coverage is not achieved.
  • C. Correct. A and B each take true and false, but the decision 'A and B' is never true.
Practice this topic Back to topic

Related calculators

Books on Software Development and Project Management Ad

As an Amazon Associate I earn from qualifying purchases.

More Software Development and Project Management questions

  1. In bottom-up testing, what is built to stand in for a higher-level module that does not exist yet, so that it calls the lower-level module under test, passes it test data and receives the results?
  2. During testing, a reliability growth curve was plotted with the test time (or the number of test cases executed) on the horizontal axis and the cumulative number of defects found on the vertical axis. The curve is still rising, with no sign of saturating (leveling off). Which judgment is most appropriate?
  3. In the integration testing of firmware with 25 KLOC (25,000 lines), 30 defects were found. Based on the organization's past results, the guideline for defects found in this phase is 2 to 4 per KLOC. Which is the most appropriate evaluation of this result?
  4. In Git, two developers changed the same line of the same file on different branches, and one branch was then merged into the other. Which describes what happens?
  5. Which method of reviewing design documents or source code is led by a moderator, assigns roles to the participants, is carried out formally using checklists and the like, and records the defects found and confirms their correction?