Answer
Yes, at the top safety levels: DO-178C Level A and ECSS category A software needs 100% statement, decision and MC/DC coverage from tests written against requirements.
Verdict on the code under testYes
Why
- Blast radiussafety-or-legal
- Change frequencyrarely
- Detectabilitynever
- Reversibilityimpossible
- Test costheavy
Yes, at the top safety levels the standard requires 100%, and rule R2 gives Test mandatory. The typical case is a team writing flight or spacecraft software under DO-178C or ECSS, asking about code its requirements-based tests have not reached. Blast radius is safety-or-legal and Reversibility is impossible, because a failure can injure a person. Detectability is never, since an unrun branch first runs in service; Change frequency is rarely, since a certified baseline changes only through change requests, and Test cost is heavy, because the last branches need the target rig. The framework does not set the figure: its limits leave that to your safety standard.
| When | Decision | Why |
|---|---|---|
| The uncovered code is deactivated: built in, but switched off by a configuration flag on this aircraft | Test it differently: a reviewed analysis showing that the flag cannot switch the code on | Test cost rises to prohibitive, because the code cannot run in the certified configuration |
| ECSS category C space software, where a failure degrades the mission and harms nobody | Test mandatory, to the coverage figure agreed with the customer | Blast radius drops to money, and Reversibility stays impossible, so rule R3 keeps the decision; the framework's limits leave the coverage figure to the standard |
| In-flight entertainment software at DO-178C Level E, with no effect on safety | Test minimally: one test of each main path, no coverage objective | Blast radius drops to users and Detectability to same-day; Reversibility falls to with-effort and Test cost to moderate |
| A control-law prototype that one engineer runs in a desktop simulator and then discards | Do not test it; the engineer reads the simulator plots, and the flight code gets its own tests | Blast radius drops to none, because only the engineer sees the result |
What breaks if you don't test
Unrun branches handle rare cases, such as two sensors that disagree, so the crew meets the failure the first time that case occurs in flight. A coverage report with unexplained gaps also fails DO-178C Table A-7 and ECSS-E-ST-40C clause 5.8.3.5, and the software is not accepted.
What you lose if you over-test
Tests written from the code to reach a line earn no credit: DO-248A, quoted in the NASA MC/DC tutorial, says structural testing does not meet the objective, because coverage must come from requirements-based tests. MC/DC on Level C code adds cases that no auditor asked for. And 100% MC/DC shows that the code matches its requirements, not that the requirements match the aircraft.
How to test
- Look up the criterion for your level. DO-178C asks for statement coverage at Level C, adds decision coverage at Level B and MC/DC at Level A. ECSS-E-ST-40C asks for 100% statement and decision coverage in categories A and B, and MC/DC in A.
- Measure coverage across unit, integration and system tests from the first test.
- For each gap, find the cause that DO-178B section 6.4.4.3 lists: a missing test, a missing requirement, dead code (remove it) or deactivated code (analyse it).
- Write each missing test from a requirement, never from the code.
MC/DC needs at least n + 1 cases for n conditions (NASA MC/DC tutorial). A simplified thrust reverser rule:
#include <assert.h>
#include <stdbool.h>
/* Requirement: unlock the reversers when armed and
(wheels spun up or weight on wheels). */
bool unlock_reversers(bool armed, bool spun_up, bool on_ground) {
return armed && (spun_up || on_ground);
}
/* 3 conditions, 4 cases. Each pair differs in one input and flips the result. */
void test_unlock_reversers(void) {
assert(unlock_reversers(true, true, false) == true); /* 1 */
assert(unlock_reversers(false, true, false) == false); /* 2: armed, vs 1 */
assert(unlock_reversers(true, false, false) == false); /* 3: spun_up, vs 1 */
assert(unlock_reversers(true, false, true) == true); /* 4: on_ground, vs 3 */
}
Cases 1 and 2 alone give 100% statement and decision coverage. If someone deletes || on_ground, only case 4 fails.
When the answer changes
- The hazard assessment puts the function at DO-178C Level D, which has no structural coverage objective.
- The software is a medical device: IEC 62304 names no figure, and FDA guidance asks for coverage that matches the risk.
Cost estimate + Code example
What 100% cost on a satellite terminal
Prause and colleagues interviewed the team that raised unit test coverage on laser terminal software for the Sentinel and EDRS satellites (PROFES 2017). The software was ECSS category C, where the standard sets no figure; the 100% statement and branch target came from the customer, DLR. The code had about 25,000 lines. Two developers spent two years, four person-years plus support staff, and reached more than 99.5% on both. The tests found between 20 and 30 possible errors, fewer than three of them potentially serious.
At my assumption of 1,600 working hours per person-year, that is 6,400 hours: about 15 minutes per line of code, at least 210 hours per possible error, and at least 3,200 hours per serious one. All the interviewees said they would demand 100% for category A, where a failure can cost lives, and most said less may be fine where the loss is a mission. They also warned that unit tests cannot be added after the code freeze, so the coverage target has to be set at the start.
Sources
- www.drprause.de/pub/PROFES2017-100PercentTestCoverageRequirement.pdf
- ntrs.nasa.gov/api/citations/20010057789/downloads/20010057789.pdf
- ecss.nl/wp-content/uploads/2025/05/ECSS-E-ST-40C-Rev.1(30April2025).pdf
- www.fda.gov/media/73141/download
- blog.johner-institute.com/iec-62304-medical-software/unit-testing-iec-62304
Related questions
FAQ
- Does DO-178C require 100% code coverage?
Yes, DO-178C requires full structural coverage at Levels A to C: statement coverage at Level C, decision coverage added at Level B, and MC/DC added at Level A. Level D has no structural coverage objective.
- What coverage does IEC 62304 require?
IEC 62304 names no coverage figure for any software safety class; for Class C the manufacturer sets the acceptance criteria for unit verification. FDA's General Principles of Software Validation calls decision coverage alone insufficient for high-integrity applications.
- What if safety-critical code cannot be reached by a test?
Code that no test can reach needs a documented analysis, inspection or design review, as ECSS-E-ST-40C clause 5.8.3.5 allows when the gap is justified. Under DO-178C, dead code is removed and deactivated code gets an analysis showing it cannot run.