Ground Truth

Does Test Discipline Actually Reduce Bugs? The Honest Numbers

Mostafa DhouibMostafa Dhouib··5 min read
The short answer

Four industrial teams saw pre release defect density fall between 40 and 90 percent, at a subjective cost of 15 to 35 percent more initial development time. A controlled study of 24 professionals found an 18 percent higher pass rate at 16 percent more time. Directionally strong, causally soft, and not free.

Does Test Discipline Actually Reduce Bugs? The Honest Numbers

The short answer. Four industrial teams saw pre release defect density fall between 40 and 90 percent, at a subjective cost of 15 to 35 percent more initial development time. A controlled study of 24 professionals found an 18 percent higher functional pass rate at 16 percent more time. Directionally strong, causally soft, and not free.

Somebody eventually asks what the rigor costs, usually in a budget meeting, and the honest answer has two halves. Quoting only the first half is how this evidence gets discredited by the person who goes and reads the paper.

The industrial case study

Nagappan, Maximilien, Bhat and Williams, in Empirical Software Engineering 13(3), 2008.

Four industrial teams, three at Microsoft and one at IBM, with codebases ranging from 6 KLOC to 155 KLOC, adopting test driven development and compared against similar projects that did not.

The pre release defect density of the four products decreased between 40 and 90 percent relative to those comparison projects. By organisation, roughly 40 percent at IBM and 60 to 90 percent across the Microsoft teams.

And the cost, from the same paper, reported by the teams themselves: a 15 to 35 percent increase in initial development time.

What the rigor buys
Pre release defect density
down 40 to 90%
four industrial teams, three at Microsoft and one at IBM
Functional test pass rate
up about 18%
controlled study, 24 professional engineers
What it costs
Initial development time
up 15 to 35%
subjective, reported by the teams themselves
The same, in the controlled study
up about 16%
quote both, or neither
Case studies with self selected teams, no randomisation, and comparison against similar rather than identical projects. Directionally strong, causally soft.
FigureBoth halves of the finding, quoted together, because an article that reports only the defect reduction is doing the thing this pillar warns against.

The caveats, which are load bearing

This is a case study and quasi-experimental design, not a randomised controlled trial. Specifically:

The teams self selected. Teams that choose to adopt a discipline are not a random sample of teams. They may be more motivated, better led, or working on more tractable problems, and any of those would produce the same result with no causal contribution from the practice.

There was no randomisation.

The comparison was against "similar" projects, not identical ones. Similar is doing a lot of work in a claim of this size.

The time cost figure is subjective, reported by the teams rather than measured.

Directionally strong, causally soft. Do not present it as an RCT, and do not quote the 90 percent without the design.

That caution is not throat clearing. A pillar built on the argument that you must not show only the flattering half of the evidence cannot then quote a 40 to 90 percent defect reduction as though it were settled.

The controlled study

George and Williams, 2003, ran a controlled study with 24 professional engineers.

TDD produced roughly an 18 percent higher functional black box test pass rate, at roughly 16 percent more development time.

Smaller effect, smaller sample, better design. It corroborates both halves independently, which is the useful thing about it: the quality gain and the time cost both survive a move from case study to controlled comparison, at roughly half the magnitude on the benefit side.

What the standards side adds

DO-178C's structure exists because unstructured testing was demonstrated insufficient for software whose failure kills people.

The order is the argument: requirements based testing first, then structural coverage measured to find code that no requirement exercised. That is an institutional encoding of "prove your tests exercise what matters, then prove nothing important is untested", arrived at by a certification body rather than by a study, and holding for decades in the domain with the least tolerance for being wrong.

It is not evidence in the same sense as a controlled trial. It is evidence that the people with the strongest incentive to get this right converged on the same shape.

How to use these numbers in a budget conversation

Quote both halves, always. "Defect density down 40 to 90 percent, development time up 15 to 35 percent, from industrial case studies with self selected teams." That sentence is defensible against somebody who has read the paper, and the shorter version is not.

For regulated or safety relevant product, budget for more. Roughly 15 to 35 percent more up front effort is the TDD derived figure. Top assurance level rigor, meaning ASIL D or DO-178C Level A obligations, is commonly estimated at 3 to 5 times. That multiplier comes from industry estimates rather than a controlled study, and should be presented that way.

Note what the money buys and what it does not. These numbers are about a development discipline, not about the specific practices in this pillar. Nobody has run a controlled trial on "keep a must-fail case in CI" or "assert units at every contractor boundary", and it would be dishonest to imply the 40 to 90 percent transfers to them.

Lead with the free one. The cheapest item in the whole pillar has no measured cost at all: delete one line of production code, or flip one condition, and see whether anything goes red. It needs no tooling, it runs in minutes, and it produces evidence about your suite that no percentage can.

The general argument is in a test that has never failed is a decoration. What the evidence says about the metric most organisations actually report is in what the research actually says about coverage.

FAQ

Does test driven development reduce defects? Four industrial teams saw pre release defect density fall between 40 and 90 percent relative to similar projects, roughly 40 percent at IBM and 60 to 90 percent across three Microsoft teams. A controlled study of 24 professionals found an 18 percent higher functional pass rate.

How much does TDD slow development down? The industrial teams subjectively reported 15 to 35 percent more initial development time. The controlled study measured roughly 16 percent.

Are the TDD studies randomised trials? The industrial one is not. Self selected teams, no randomisation, and comparison against similar rather than identical projects. It is directionally strong and causally soft. The George and Williams study is controlled, with a smaller sample and a smaller effect.

What does rigorous verification cost in a regulated product? Roughly 15 to 35 percent more up front effort from the TDD data, and commonly estimated at 3 to 5 times for top assurance level obligations. That multiplier comes from industry estimates rather than a controlled study.

Does this evidence support the specific practices in this pillar? Not directly. These studies measure a development discipline. No controlled trial has been run on keeping a must-fail case in CI or asserting units at boundaries, and claiming the 40 to 90 percent transfers to them would overstate what is known.

Free checklist
The Verification Diligence Checklist

Nine controls, each tied to a public failure that cost somebody nine figures or a life, with the four artifacts a verification data room holds and the one question an investor should ask in the room. Built to be printed and ticked only where somebody has actually watched the check go red.

One email, the resource, and nothing else unless you reply.
Carrying a program like this one?

Tell us the system, the stakes, and the date that matters. You get a straight technical reply from the person who would lead the work, within 24 hours.

Bring us the program