MCDC Testing
   HOME

TheInfoList



OR:

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 An examination (exam or evaluation) or test is an educational assessment intended to measure a test-taker's knowledge, skill, aptitude, physical fitness, or classification in many other topics (e.g., beliefs). A test may be administered verba ...
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 SIL, Sil and sil may refer to: Organizations * Servis Industries Limited, Pakistan * Smithsonian Institution Libraries * SIL International, formerly Summer Institute of Linguistics * Apex Silver Mines (former American Stock Exchange ticker symb ...
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.


Definitions

;Condition: A condition is a leaf-level
Boolean Any kind of logic, function, expression, or theory based on the work of George Boole is considered Boolean. Related to this, "Boolean" may refer to: * Boolean data type, a form of data with only two possible values (usually "true" and "false" ...
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: /* Function A */ void function_a (int a, bool b, bool c, bool d, bool e, bool f) /* Function B */ void function_b (int a, bool b, bool c, bool d, bool e, bool f) if the definition of a decision is treated as if it is an 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 Sergiy A. Vilkomir (November 19, 1956 – February 9, 2020) was a Ukrainians, Ukrainian-born computer scientist. Sergiy Vilkomir was born in 1956 in present-day Ukraine. He finished Mathematical College at the Moscow State University National M ...
proposed reinforced condition/decision coverage (RC/DC) as a stronger version of the MC/DC coverage criterion that is suitable for
safety-critical system A safety-critical system (SCS) or life-critical system is a system whose failure or malfunction may result in one (or more) of the following outcomes: * death or serious injury to people * loss or severe damage to equipment/property * environme ...
s.
Jonathan Bowen Jonathan P. Bowen FBCS FRSA (born 1956) is a British computer scientist and an Emeritus Professor at London South Bank University, where he headed the Centre for Applied Formal Methods. Prof. Bowen is also the Chairman of Museophile Limited ...
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 Elementary comparison testing (ECT) is a white-box, control-flow, test-design methodology used in software development.Lee Copeland (2004). ''A Practitioners Guide to Software Test Design'', chapter 10. Artech House Publishers, Norwood. . The purp ...


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
{{DEFAULTSORT:Modified condition decision coverage Software testing