Desk summary
- 01Structural coverage analysis measures how much of the code’s structure the requirements-based tests exercised. It is a completeness check on testing, not a way to create tests.
- 02Level C needs statement coverage; Level B adds decision coverage; Level A adds MC/DC and, for object code not traceable to source, extra verification (Table A-7 objectives 5–7 and 9).
- 03MC/DC shows each condition in a decision independently affects the outcome — typically n+1 to 2n tests for n conditions instead of 2ⁿ.
- 04Coverage may be measured on source, object or executable object code (
§6.4.4.2); each choice has its own obligations. - 05Every gap is explained and resolved: missing test, missing or wrong requirement, dead/extraneous code (remove it) or deactivated code (justify it) —
§6.4.4.3.
Intuition
Coverage is the dye in the plumbing
Imagine pouring dye into a building’s water supply and then running every tap the building specification says should work. Afterwards you inspect the pipes: any pipe without dye is a pipe your specification never needed. Either you forgot to test a tap (missing test), the specification forgot to mention a tap (missing requirement), or the pipe goes nowhere and should be removed (dead code). What you must not do is go and open the undyed pipe directly just to colour it — that tells you nothing about whether the building meets its specification.
Why coverage measures test completeness
Requirements-based tests can be incomplete in ways that no review of the tests alone will reveal: a requirement may be implemented with more logic than the tests discriminate, or the code may contain behaviour no requirement asked for. Structural coverage analysis runs the requirements-based tests with the code instrumented (or traced on target) and records which statements, decisions and conditions were exercised. What remains unexercised is a signal — of weak tests, of incomplete requirements, or of code that should not be there.
- —It reveals untested functionality (the tests missed something the requirements describe).
- —It reveals unintended functionality (code no requirement asked for, including dead and extraneous code).
- —It helps confirm that deactivated code really is deactivated.
- —At Level A, MC/DC also checks that the tests discriminated each condition of complex logic — catching many wrong-operator and wrong-variable errors.
- —It provides an objective stopping criterion for testing, though it does not measure how thorough the robustness testing was.
Pitfall
Writing tests to make the tool happy
Running a coverage tool early is good practice. Using the uncovered lines it reports as a to-do list for new tests is not: tests reverse-engineered from code verify what the code does, not what it should do. Many systems hit 50% statement coverage just by powering up. Write and review tests from requirements first, then measure. Many teams assign the coverage analysis to an engineer who did not write the tests, which also helps with the Level A/B independence required for these objectives.
Note
Structural coverage analysis ≠ structural testing
Textbooks describe “structural” or “white-box” testing — writing tests from the code. DO-178C’s structural coverage analysis is different: it examines the effect of requirements-based tests on the code. Structural testing alone cannot satisfy DO-178C, because its tests have no requirements basis.
Statement, decision and MC/DC
Condition
A Boolean expression with no Boolean operators other than NOT — e.g. gear_down, alt < 500, !wow.
Decision
A Boolean expression made of conditions and zero or more Boolean operators. Each occurrence of a repeated condition counts separately. A decision is not only the expression in an if; a Boolean assignment such as warn = a && b; is a decision too.
Statement coverage
Every statement in the program has been executed at least once.
Decision coverage
Every entry and exit point has been invoked, and every decision has taken both outcomes (true and false).
Condition coverage
Every condition has taken both values. (Not a DO-178C criterion on its own, but part of MC/DC.)
MC/DC
Decision coverage, plus every condition has taken both values, plus each condition has been shown to independently affect its decision’s outcome.
Multiple condition coverage
Every combination of condition values — 2ⁿ tests. Exhaustive and usually impractical; not required by DO-178C.
Coverage required by software level (Table A-7; at Level A all are met with independence — see the live table for Level B)
| Level | Statement (obj. 7) | Decision (obj. 6) | MC/DC (obj. 5) | Additional object code (obj. 9) |
|---|---|---|---|---|
| A | Required | Required | Required | Required |
| B | Required | Required | — | — |
| C | Yes | — | — | — |
| D | — | — | — | — |
Take one line of flap-protection logic: if ((weight_on_wheels && airspeed_low) || maint_override) { allow_flap_test(); } — call the conditions A, B and C. The table shows what each criterion demands.
Minimum tests for if ((A && B) || C) { … }
| Criterion | What must happen | Example minimal set (A,B,C → outcome) | Tests |
|---|---|---|---|
| Statement | The body runs once | T,T,F → T | 1 |
| Decision | Decision true once and false once | T,T,F → T; F,F,F → F | 2 |
| Condition | Each of A, B, C true once and false once (decision outcome irrelevant) | T,F,T → T; F,T,F → F | 2 (shows why condition coverage alone is weak) |
| MC/DC | Decision both ways, each condition both ways, each condition independently flips the outcome | T,T,F → T; F,T,F → F; T,F,F → F; T,F,T → T | 4 (n+1) |
| Multiple condition | All combinations | All 8 rows | 8 (2ⁿ) |
Worked example
A decision with no branch
Consider gear_warning = !gear_down && (radio_alt < 500) && throttle_idle; executed every frame. One execution gives 100% statement coverage, and there is no if, so a branch-coverage tool may report nothing missing. Under DO-178C’s definition this is a decision: Level B needs it seen both true and false, and Level A needs MC/DC on its three conditions. Make sure your coverage tool treats Boolean assignments and Boolean arguments as decisions — not every tool does by default.
MC/DC, intuitively
MC/DC asks a simple question about every condition in a decision: does this condition actually matter, and did our tests prove it? To show it, you need a pair of tests — an independence pair — in which that condition changes value, the decision outcome changes too, and nothing else that could affect the outcome changed. If you cannot find such a pair, either your tests did not discriminate that condition (a test gap) or the condition cannot matter (a design or requirement problem: why is it there?).
Intuition
The light-switch test
A room has a light controlled by two switches in series (AND). To prove each switch is really wired in, you need three experiments: both on (light on), switch 1 off (light off), switch 2 off (light off). Flipping one switch and watching the light change proves that switch is connected. Testing every combination (four for two switches, 1,024 for ten) would tell you little more. That is the whole idea of MC/DC: n+1 well-chosen experiments instead of 2ⁿ.
Gate-level patterns for n conditions (NASA MC/DC tutorial approach)
| Operator | Tests needed | Pattern |
|---|---|---|
| A && B && C (AND) | n+1 = 4 | All true (→T); then each input false in turn with the others true (→F) |
| A || B || C (OR) | n+1 = 4 | All false (→F); then each input true in turn with the others false (→T) |
| !A (NOT) | 2 | A true and A false |
| A ^ B (XOR) | 3 | Any three of the four combinations |
MC/DC lab
Pick test rows. Watch which coverage criteria they satisfy.
Operators: && || ! and parentheses (or the words and / or / not). Up to 5 conditions. Auto-deploy ground spoilers when armed, thrust at idle and the aircraft is on the ground (weight-on-wheels or wheel spin-up).
| TEST | ROW | Armed | ThrIdle | WOW | WheelSpin | OUTCOME |
|---|---|---|---|---|---|---|
| 1 | F | F | F | F | F | |
| 2 | F | F | F | T | F | |
| 3 | F | F | T | F | F | |
| 4 | F | F | T | T | F | |
| 5 | F | T | F | F | F | |
| 6 | F | T | F | T | F | |
| 7 | F | T | T | F | F | |
| 8 | F | T | T | T | F | |
| 9 | T | F | F | F | F | |
| 10 | T | F | F | T | F | |
| 11 | T | F | T | F | F | |
| 12 | T | F | T | T | F | |
| 13 | T | T | F | F | F | |
| 14 | T | T | F | T | T | |
| 15 | T | T | T | F | T | |
| 16 | T | T | T | T | T |
Decision coverage
NOT MET
Outcome seen both true and false. Level B
Condition coverage
NOT MET
Every condition seen both true and false. Not a DO-178C criterion
MC/DC
NOT MET
Every condition shown to independently affect the outcome. Level A
Independence pairs (hover a condition to highlight)
Armed
MISSING
Candidate pairs: 6–14, 7–15, 8–16
ThrIdle
MISSING
Candidate pairs: 10–14, 11–15, 12–16
WOW
MISSING
Candidate pairs: 13–15
WheelSpin
MISSING
Candidate pairs: 13–14
0 tests selected for 4 conditions. Unique-cause MC/DC usually needs N+1 tests for N conditions (here 5); exhaustive testing would need 16. This lab checks unique-cause MC/DC; masking MC/DC accepts more pairs when a condition's change is masked by short-circuit logic.
Worked example 1: unique-cause MC/DC for (A && B) || C
In unique-cause MC/DC, each independence pair differs in exactly one condition. Write out the truth table, then look for pairs.
Truth table and independence pairs for (A && B) || C
| Row | A | B | C | Outcome | Pairs it can join |
|---|---|---|---|---|---|
| 1 | F | F | F | F | C (with 2) |
| 2 | F | F | T | T | C (with 1) |
| 3 | F | T | F | F | A (with 7), C (with 4) |
| 4 | F | T | T | T | C (with 3) |
| 5 | T | F | F | F | B (with 7), C (with 6) |
| 6 | T | F | T | T | C (with 5) |
| 7 | T | T | F | T | A (with 3), B (with 5) |
| 8 | T | T | T | T | none — C cannot flip the outcome when A && B is true |
A has only one pair (3, 7) and B only one (5, 7), so rows 3, 5 and 7 are mandatory. C has several options; choosing (5, 6) reuses row 5. Result: rows {3, 5, 6, 7} — four tests for three conditions, the n+1 minimum. Every condition has been both true and false, the decision has been both true and false, and each condition has a pair that proves its independent effect.
Worked example 2: masking MC/DC and coupled conditions
Unique-cause MC/DC breaks down when conditions are coupled — when changing one necessarily changes another. The classic case is a selector: out = (A && B) || (!A && C), which picks B when A is true and C otherwise. A appears twice, and DO-178C counts each occurrence as a separate condition. You cannot change the first A while holding the second fixed, so a unique-cause pair for either occurrence does not exist.
Masking MC/DC relaxes the rule: you may let other conditions change as long as they cannot affect the outcome in that pair — they are “masked”. Masking works through the logic: a false input to an AND, or a true input to an OR, makes the gate’s other inputs irrelevant. DO-178C’s definition explicitly allows this, by permitting a condition to be varied while holding fixed only those conditions “that could affect the outcome”. Certification authorities accept masking MC/DC (CAST-6 set out the rationale).
Masking MC/DC for out = (A₁ && B) || (!A₂ && C), where A₁ and A₂ are the same variable
| Condition shown | Test pair (A, B, C) | Outcomes | Why the other occurrence is masked |
|---|---|---|---|
| A₁ (first A) | (T, T, F) vs (F, T, F) | T vs F | C = F makes the second AND false in both tests, so the change in !A₂ cannot reach the output |
| A₂ (second A) | (T, F, T) vs (F, F, T) | F vs T | B = F makes the first AND false in both tests, so the change in A₁ cannot reach the output |
| B | (T, T, F) vs (T, F, F) | T vs F | Unique-cause pair (only B changes) |
| C | (F, F, T) vs (F, F, F) | T vs F | Unique-cause pair (only C changes) |
Note
Unique-cause vs masking at a glance
Unique-cause is stricter and easier to check mechanically, but impossible for strongly coupled conditions. Masking is always at least as achievable, is permitted by DO-178C, and research for the FAA (Chilenski, DOT/FAA/AR-01/18) found its error-detection capability close to unique-cause in practice. State in the SVP which form your tool and analysis use. Unique-cause plus short-circuit “don’t care” handling sits between the two.
Worked example 3: short-circuit operators
In C and Ada (and then/or else), && and || stop evaluating as soon as the result is known. In if (sensor_valid && (sensor_value > LIMIT)), the second condition is never evaluated when the first is false. For MC/DC this means some conditions are simply not evaluated in some tests: their values are “don’t care” (X). Short-circuiting reduces the number of distinct combinations and makes the compiled code look like nested branches, one per condition.
MC/DC for a short-circuit A && B
| Test | A | B | Outcome | Shows |
|---|---|---|---|---|
| 1 | T | T | T | Reference row for both pairs |
| 2 | F | X (not evaluated) | F | A independently affects outcome (pair 1–2) |
| 3 | T | F | F | B independently affects outcome (pair 1–3) |
Practitioner tip
Short-circuit also protects you
Short-circuit evaluation is often a robustness feature, as in if (p != NULL && p->valid). A coverage tool that requires the second condition to be evaluated as true and false when the first is false is demanding something impossible. Confirm your tool understands the language’s evaluation rules — the FAA’s tools assessment study found anomalies in every coverage tool it examined.
Worked example 4: a condition that cannot matter
Suppose the code reads if (ap_engaged && (ap_engaged || fd_on)) { … }. However you choose tests, the second occurrence of ap_engaged and fd_on cannot independently change the outcome: whenever the first condition is true, the OR is already true. MC/DC cannot be achieved — and that is the point. The analysis has found redundant logic, which may hide an error (perhaps the requirement meant ap_engaged || fd_on alone). The resolution is to fix the requirement or the code, not to write a cleverer test.
What the auditor looks for
What reviewers look for in MC/DC evidence
Which form of MC/DC was used and is it stated in the plans? Does the tool’s notion of “decision” include Boolean assignments and parameters? Are the passing tests the ones credited (coverage from a failed test may not be valid)? Were instrumented results compared with uninstrumented runs? For each uncovered condition, is there a gap analysis with a specific resolution? A spot check where the reviewer derives independence pairs by hand for a few complex decisions is common.
Source code vs object code coverage
DO-178C §6.4.4.2 permits structural coverage analysis on source code, object code or executable object code. Most projects measure at source level because tools are widely available and results map directly to requirements and LLR. Measuring on object code has an appeal — it is closer to what flies — but brings its own questions, collected in CAST-17 and DO-248C (FAQ #42).
Where to measure
Source-level coverage
Object / executable code coverage
Intuition
Why object branches may not equal MC/DC
With short-circuit evaluation, if (A && B) usually compiles to two conditional jumps, one per condition, so covering both directions of every jump comes close to MC/DC. But x = A & B; or an optimiser that turns the logic into arithmetic produces no jumps at all. Object-code coverage then says “100%” while the conditions were never discriminated. Anyone claiming MC/DC from object code must show, for their compiler and coding constructs, that the object-level criterion is at least as strong.
Level A: code not traceable to source (objective 9)
At Level A, if the compiler, linker or other means generates object code that is not directly traceable to source code statements, that additional code must be verified. Examples include array bounds checks inserted by the compiler, run-time library calls for floating-point or division, jump tables for switch, loop unrolling, inlining, stack-probe and prologue code. Coverage measured on source code cannot see any of this.
Typical source-to-object code traceability analysis
Pick a representative sample
Cover every construct the coding standard allows and their combinations; projects commonly aim for a meaningful sample of the code base rather than 100%.
Compile with flight settings
Same compiler version, options and optimisation level as the certified build.
Compare line by line
Map each block of object or assembly code to its source statement; identify anything added, removed or restructured.
Explain every untraceable block
Show it is correct and deterministic, verify it (e.g. by additional tests or analysis), or prohibit the construct that causes it.
Keep it valid
Reassess when the compiler, options or the set of constructs used changes. The analysis can be reused across projects with the same toolchain and constructs.
Practitioner tip
Keep optimisation modest
Aggressive optimisation (instruction scheduling, register tracking, heavy inlining) makes object-to-source traceability far harder and can make the analysis impractical. Most Level A programmes freeze a conservative optimisation level early, document it in the plans and enforce it in the build.
Resolving coverage gaps
DO-178C §6.4.4.3 lists the possible causes of uncovered structure, and each has a different resolution. The gap analysis — what was uncovered, why, and what was done — is recorded in the verification results and is read closely by the authority.
Coverage gap causes and resolutions
| Cause | Example | Resolution |
|---|---|---|
| Shortcoming in the requirements-based tests | Dual-sensor averaging never tested with sensor 1 invalid | Add or improve test cases from the existing requirement; rerun |
| Inadequate requirements | Code clamps rate commands to ±60°/s but no requirement says so | Add or correct the requirement (and assess for derived-requirement safety impact); add tests |
| Dead code | A branch left from an earlier design that can never execute | Remove it; assess the effect and re-verify as needed |
| Extraneous code | Legacy routine kept after its requirement was deleted | Remove it (or, rarely, justify per plan); re-verify |
| Deactivated code | Options for another aircraft variant, disabled by configuration | Show the deactivation mechanism is verified and the code cannot be inadvertently activated; the code is covered in the configuration where it is used |
| Defensive / robustness code that cannot be reached by tests on target | Range check that a validated upstream input can never violate | Trace to a robustness requirement; cover with low-level test, fault injection or documented analysis |
Worked example
Range constraints that make logic unreachable
In the helicopter FCC reference project, a model analysis found that the upper-limit branch of the actuator saturation blocks could never be true given the declared ranges of their inputs. When coverage reports the same branch uncovered, the team has a decision to make: if the saturation is required defensive behaviour (in case an upstream assumption is violated), trace it to a robustness requirement and verify it by fault-injected low-level test or analysis; if the limit is genuinely redundant, consider removing it. Writing “unreachable — OK” is not a resolution.
Model-based development
Model coverage vs code coverage
DO-331 introduces model coverage analysis for design models: running the requirements-based simulation cases and checking which parts of the model (blocks, transitions, logic conditions) were exercised. Its purpose is to detect unintended functionality and requirements-based test gaps in the model. It does not replace structural coverage of the code: generated code can contain structure the model view does not show (and vice versa), so Table A-7 code coverage is still required. In the reference project the same tests gave 97% decision coverage on the model and 93% on host-compiled generated code — the gaps were not identical. Many teams use model coverage early to drive requirement and test completeness, then confirm with code coverage on the integrated build. See Model Coverage Analysis.
Pitfall
Coverage from tests that failed or ran on the wrong build
Coverage credit should come from passing requirements-based tests run on the configuration being certified. Coverage merged across builds, from tests that failed, or from debug sessions with breakpoints is not valid evidence. Keep coverage runs tied to the formal test run records.
Self-check
For the decision A || B || C (no short-circuit concerns), which test set achieves unique-cause MC/DC?