07 — Verification

Evidence at every level.

+ The questionWhich tests, at which level, give evidence a regulator accepts, and when is testing enough?

A sequence of steps nobody combined

In February 2023 Elekta began correcting its Monaco radiotherapy treatment planning system, the software a planner uses to design the radiation beams for a patient and to compute the dose they will deliver. Elekta had found that one sequence of user steps could make the system display an inaccurate dose. The problem arose when a planner added contours, outlines of structures drawn on the patient's images, and then re-optimized the plan, so that the system recalculated the beam settings to meet the plan's dose goals. The system computes dose from the density of the tissue, and a planner can force a fixed density value onto a region. If no density value was forced outside the patient's external outline, the system could display a dose distribution that did not match what the plan would deliver.

The correction covered 2,020 installed systems running four builds of version 5.11, and the FDA recorded the root cause as software design. Drawing a contour, assigning densities, optimizing a plan and displaying a dose were each an ordinary use of the software; the fault lay in their combination. Failures of this kind are why device software is tested at more than one level. A test of a single function can show that the function meets its own specification. Only tests that combine functions in the sequences users actually follow can show how the functions behave together, and only tests of the whole system in its intended environment can show whether the device does what its users need.

Levels of evidence

Verification is the FDA's term for objective evidence that the outputs of a stage of development meet the requirements set for that stage: in short, evidence that the software was built as specified. Verification happens at several levels. Unit testing checks each unit in isolation against its detailed design, often automatically. Integration testing checks that units and items work together, including at the segregation boundaries of Chapter 5. System testing checks the complete software against the software requirements, usually on the real hardware. Other verification activities find faults without running the code at all: reviews of requirements and design, inspection of the code by a second engineer, and static analysis tools that search the source for whole classes of mistakes, such as reading a memory location before any value was written to it.

Under IEC 62304, every class needs system testing, class B and above also need unit and integration verification, and each of these activities must leave records. In its 2023 guidance on premarket software documentation, the FDA asks for a summary of unit, integration and system testing at the Basic documentation level, with the protocol and report of the system-level tests. At the Enhanced level it also asks for the protocols and reports of the unit and integration tests. The standard and the FDA both ask for a list of the unresolved anomalies: the known defects the software will ship with, each with an assessment of its effect on safety and effectiveness. A maker can release a device with known defects, provided it has judged each one and none leaves an unacceptable risk.

13 — Verification at three levels, validation above them
user needs and intended use validation: usability and clinical evidence validates software requirements system tests verifies architecture (items) integration tests verifies detailed design (units) unit tests CODE where combinations fail (Monaco, 2023) verification: built as specified validation: the right specification IEC 62304 covers verification; device validation is outside its scope find faults without running the code REVIEWS STATIC ANALYSIS CODE INSPECTION FDA 2023, Basic: summary + system test protocol and report; Enhanced adds unit and integration protocols and reports the V is a map of evidence, not an order of work
SpecificationCodeReadoutFocal detail
Plate 13 — Each level of specification is checked by its own level of testing, and validation asks whether the specification itself meets users' needs. Faults that live in combinations of functions, like the Monaco dose display, surface at integration and system level.

How much testing is enough

Chapter 3 showed that the answer cannot be "all of it". Coverage tools measure part of the answer: they count how much of the code a test campaign executed. The FDA's 2002 guidance on software validation describes a series of coverage measures. Statement coverage runs every line at least once, and the FDA calls it insufficient to provide confidence. Decision coverage, also called branch coverage, takes each decision both ways. Condition coverage makes each condition inside a decision both true and false. Multiple-condition coverage tries every combination of the conditions in each decision. Full path coverage would run every possible route through the program, and the FDA calls it generally not achievable. The FDA does not prescribe a level; the maker chooses one in proportion to risk and justifies it.

Solved example: one decision, three coverage measures

An infusion pump stops when "(line pressure is high AND the occlusion alarm is enabled) OR the door is open". The occlusion alarm warns of a blocked line. Decision coverage needs two tests: one in which the pump stops and one in which it does not. Condition coverage can also be met with two tests: one with all three conditions true and one with all three false, a pair that never shows what happens when pressure is high but the alarm is disabled. Multiple-condition coverage needs every combination of the three conditions: two to the power three, or 8 tests. For one decision the difference between 2 tests and 8 is small, but the number needed for multiple-condition coverage doubles with every condition added to a decision: a decision with ten conditions needs 1,024 tests. Across a program with thousands of decisions, many with several conditions, that growth separates a campaign that can be run every night from one that cannot. That is why the strictest measures are kept for the code whose failure could cause serious harm.

Coverage measures show what ran, not what was checked. A team therefore pairs them with three measures of what was checked: every requirement traced to at least one test that would fail if the requirement were broken, every hazard-related sequence from the risk analysis tested on purpose, and combinations of settings covered by the all-pairs method of Chapter 3. The team has the evidence a reviewer looks for once three things hold: the campaign meets those targets, its tests pass, and every remaining anomaly has been judged. The team has not proved the software correct, and its documentation says so: it lists what was not tested and why.

Regression after every change

In the FDA's count of software recalls from 1992 to 1998, 79 percent came from defects introduced by changes after release, which makes regression testing the most important habit in maintenance. After each change, the team re-runs the tests that cover what the change touched and, for anything beyond a trivial change, the whole system-level suite, so that behavior verified before the change is verified again after it. A suite that runs automatically makes re-running cheap enough to do after every change, and Chapter 9 is about that automation.

IDx-DR, the guide's running case, went through a regression test of a model. In 2020 IDx renamed itself Digital Diagnostics. The renamed company replaced the classifier that judges image quality in version 2.3. To support the 510(k) for that version, which the FDA cleared in 2022, it re-ran the new version on the images from the 2017 trial and compared its answers with those of the original version. Chapter 21 shows what that comparison found, and what it could and could not prove.

14 — Every change re-runs what it could disturb
v1.0 v1.1 v1.2 v2.0 change change change regression suite: each square a test that passes fixed before release a change broke an old behavior: caught found in the build, not in the field the suite keeps every test written for every past fault (Chapter 2) schematic FDA count 1992–1998: 192 of 242 software recalls (79%) came from changes after release
CodeFaultReadoutFocal detail
Plate 14 — Regression testing re-runs earlier tests after every change, and the suite grows with each fault ever found. It is the main defense against the source of 79 percent of the software recalls the FDA counted from 1992 to 1998: changes made after release.

Verification and validation

Verification asks whether the software meets its specification; validation asks whether the specification was right. The FDA defines software validation as confirmation that software specifications conform to user needs and intended uses, made by examination and objective evidence. For a software device, validation involves more than testing code: it includes usability studies with representative users and, where the claim requires it, clinical evidence that the outputs are right for patients. IEC 62304 deliberately leaves validation out. Its scope excludes the validation and final release of the device, which belong to the maker's design controls: the quality-system procedures that govern how a device's design is planned, reviewed, verified, validated and changed.

A passing system test validates nothing about patients

A system test checks the software against requirements the team wrote. If a requirement was wrong, every test can pass while the device fails its users. An image-quality threshold set for a camera the clinics do not use would be such a requirement. Validation needs evidence from outside the specification: real users, real conditions and, for a diagnostic claim, a comparison with an independent reference.

The evidence that IDx submitted for IDx-DR's 2018 authorization included both kinds, and the company funded the trial. The trial of the opening scene validated the claim, with novice operators who had four hours of training, real patients and a reference standard (Chapter 12). A smaller study checked repeatability, whether the system gives the same answer when the same person is imaged again. Each of 24 participants was imaged ten times, by three operators on two cameras of the same model. The system analyzed 235 of the image sets, gave identical answers for 23 of the 24 participants across every repeat, and agreed with itself 99.6 percent of the time. Repeatability is not accuracy, but a screening program whose answer changed with the operator would have failed before the question of accuracy arose.

Write the verification plan as a coverage argument

For each software item, state which levels of testing apply, which coverage measure is targeted and why it fits the item's class, how requirements and hazard sequences map to tests, and which test suites are re-run after which kinds of change. Keep the unresolved-anomaly list with each release and record why each entry leaves no unacceptable risk.

+ What this chapter established
  • Device software is verified at the unit, integration and system levels, with reviews and static analysis finding faults without running the code.
  • Coverage measures how much of the code ran; a maker chooses the level in proportion to the harm a failure could cause and pairs it with requirement and hazard coverage.
  • A release may carry known defects only if each is listed and judged; regression testing after every change guards against the source of 79 percent of the software recalls the FDA counted in 1992 to 1998.
  • Verification shows the software meets its specification; validation, including usability and clinical evidence, shows the specification meets the needs of users and patients.
Created with Claude (Anthropic).
Educational reference material, not engineering, regulatory or clinical advice. Product and company names referenced are the property of their respective owners.