ArticleslgStudy

computer science

Modified condition/decision coverage

Modified condition/decision coverage is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Modified condition/decision coverage rather than just read about it. In short: Modified condition/decision coverage (MC/DC) is a code coverage criterion used in software testing. Overview MC/DC requires all of the below during testing: Each entry and exit point is invoked Each decision takes every possible outcome Each condition in a decision takes every possible outcome Each condition in a decision is shown to independently affect the outcome of the decision.

Key takeaways

  • Modified condition/decision coverage belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Modified condition/decision coverage to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Modified condition/decision coverage from memory before moving on to harder problems.

Reference excerpt

Modified condition/decision coverage (MC/DC) is a code coverage criterion used in software testing.

Overview MC/DC requires all of the below during testing:

Each entry and exit point is invoked Each decision takes every possible outcome Each condition in a decision takes every possible outcome Each condition in a decision is shown to independently affect the outcome of the decision. Independence of a condition is shown by proving that only one condition changes at a time. MC/DC is used in avionics software development guidance DO-178B and DO-178C to ensure adequate testing of the most critical (Level A) software, which is defined as that software which could provide (or prevent failure of) continued safe flight and landing of an aircraft. It is also highly recommended for SIL 4 in part 3 Annex B of the basic safety publication and ASIL D in part 6 of automotive standard ISO 26262. Additionally, NASA requires 100% MC/DC coverage for any safety critical software component in Section 3.7.4 of NPR 7150.2D. European Space Agency requires MC/DC coverage for Criticality Category A per ECSS-E-ST-40C Rev. 1

Definitions Condition A condition is a leaf-level Boolean expression (it cannot be broken down into simpler Boolean expressions). Decision A Boolean expression composed of conditions and zero or more Boolean operators. A decision without a Boolean operator is a condition. A decision does not imply a change of control flow, e.g. an assignment of a boolean expression to a variable is a decision for MC/DC. Condition coverage Every condition in a decision in the program has taken all possible outcomes at least once. Decision coverage Every point of entry and exit in the program has been invoked at least once, and every decision in the program has taken all possible outcomes at least once. Condition/decision coverage Every point of entry and exit in the program has been invoked at least once, every condition in a decision in the program has taken all possible outcomes at least once, and every decision in the program has taken all possible outcomes at least once. Modified condition/decision coverage Every point of entry and exit in the program has been invoked at least once, every condition in a decision in the program has taken all possible outcomes at least once, and each condition has been shown to affect that decision outcome independently. A condition is shown to affect a decision's outcome independently by varying just that condition while holding fixed all other possible conditions. The condition/decision criterion does not guarantee the coverage of all conditions in the module because in many test cases, some conditions of a decision are masked by the other conditions. Using the modified condition/decision criterion, each condition must be shown to be able to act on the decision outcome by itself, everything else being held fixed. The MC/DC criterion is thus much stronger than the condition/decision coverage.

Criticism

It is a misunderstanding that by purely syntactic rearrangements of decisions (breaking them into several independently evaluated conditions using temporary variables, the values of which are then used in the decision) which do not change the semantics of a program can lower the difficulty of obtaining complete MC/DC coverage. This is because MC/DC is driven by the program syntax. However, this kind of "cheating" can be done to simplify expressions, not simply to avoid MC/DC complexities. For example, assignment of the number of days in a month (excluding leap years) could be achieved by using either a switch statement or by using a table with an enumeration value as an index. The number of tests required based on the source code could be considerably different depending upon the coverage required, although semantically we would want to test both approaches with a minimum number of tests.

Another example that could be considered as "cheating" to achieve higher MC/DC is:if the definition of a decision is treated as if it is a boolean expression that changes the control flow of the program (the text in brackets in an 'if' statement) then one may think that Function B is likely to have higher MC/DC than Function A for a given set of test cases (easier to test because it needs less tests to achieve 100% MC/DC coverage), even though functionally both are the same. However, what is wrong in the previous statement is the definition of decision. A decision includes 'any' boolean expression, even for assignments to variables. In this case, the three assignments should be treated as a decision for MC/DC purposes and therefore the changed code needs exactly the same tests and number of tests to achieve MC/DC than the first one. Some code coverage tools do not use this strict interpretation of a decision and may produce false positives (reporting 100% code coverage when indeed this is not the case).

RC/DC In 2002 Sergiy Vilkomir proposed reinforced condition/decision coverage (RC/DC) as a stronger version of the MC/DC coverage criterion that is suitable for safety-critical systems. Jonathan Bowen and his co-author analyzed several variants of MC/DC and RC/DC and concluded that at least some MC/DC variants have superior coverage over RC/DC.

See also Elementary comparison testing

References

External links What is a "Decision" in Application of Modified Condition/Decision Coverage (MC/DC) and Decision Coverage (DC)? (May 1, 2020 archive) An Investigation of Three Forms of the Modified Condition Decision Coverage (MCDC) Criterion

Worked examples

Example 1 — a first encounter with Modified condition/decision coverage

Start with the simplest possible case. Write down what Modified condition/decision coverage claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Modified condition/decision coverage before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Modified condition/decision coverage ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Modified condition/decision coverage

In research
Modified condition/decision coverage appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Modified condition/decision coverage in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Modified condition/decision coverage is common in secondary-school and first-year university syllabi. It links to neighbouring topics Software testing, so understanding it makes those chapters shorter.
In everyday life
Look for Modified condition/decision coverage outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Modified condition/decision coverage” →

How to study Modified condition/decision coverage in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Modified condition/decision coverage means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Modified condition/decision coverage out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Modified condition/decision coverage in simple terms?

Modified condition/decision coverage (MC/DC) is a code coverage criterion used in software testing. Overview MC/DC requires all of the below during testing: Each entry and exit point is invoked Each decision takes every possible outcome Each condition in a decision takes every possible outcome Each…

Why does Modified condition/decision coverage matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Modified condition/decision coverage?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Modified condition/decision coverage.

Tags

  • Software testing

Keep exploring