Skip to main content

How Work Gets Done

Unit Testing

Unit tests check small pieces of code in isolation. What you are buying is not fewer bugs today, it is the ability to change the system safely for years.

Definition

A unit test checks one small piece of code does what it should, in isolation, automatically. Give this function these inputs, confirm it returns that.

What It Actually Means

A system has hundreds or thousands of them, they run in seconds, and they run on every change.

What You Are Actually Buying

Tests do find some bugs today, though a careful developer would have found most of those anyway.

What you are buying is the ability to change the system later without fear.

That is the commercial case for tests, and suppliers rarely explain it. In an untested system, every change carries unknown risk. Nobody can tell what else depends on the thing being modified, so changes get made cautiously, tested by hand, and often avoided. Development slows down permanently, and the slowdown compounds as the system grows.

In a tested system, a change that breaks something unrelated is reported in seconds, by name. Developers make changes confidently because the safety net is real, and refactoring becomes a routine activity rather than a risk.

So the cost of tests is paid at the start and the return arrives across the whole life of the system. Which means the argument against them is strongest for something short-lived and weakest for anything you intend to keep, which is usually the case.

What They Do Not Catch

Coverage figures get quoted as though they were a guarantee, so the limits matter.

A unit test checks a piece works in isolation. It cannot tell you the pieces work together, which is integration testing, and integration is where a large share of real defects live. It cannot tell you the feature makes sense, that the business rule was right, or that the interface is usable.

A system can have every unit passing and be entirely broken from a customer’s point of view. The tests are doing their job; the job is narrower than people assume.

The Coverage Trap

Coverage is the percentage of code touched by tests, and it is the metric most often reported because it is the easiest to produce.

It measures whether code ran during a test. It does not measure whether anything meaningful was checked. Tests can be written that execute a great deal and assert almost nothing, and they produce excellent coverage while catching nothing at all.

Chasing a high number tends to produce exactly those, because the remaining uncovered code is usually the awkward part that is hard to test. Eighty percent covering the parts that matter is worth considerably more than ninety-five percent achieved by testing getters.

What To Ask

  • Are the critical paths tested? Payments, permissions, anything calculating money. Rather than what the overall percentage is.
  • Do the tests run automatically on every change? Tests nobody runs are documentation.
  • When something broke in production, did a test exist for it? If not, was one added? That habit is the real signal.
  • How long do they take? More than a few minutes and developers stop running them locally.

When To Push Back

Tests are not free and not always right. A prototype being built to answer a question and then discarded does not need them. Neither does a small internal tool used by three people that would take an hour to fix if it broke.

The judgement is straightforward: how long will this live, and what does it cost when it breaks. Anything customer-facing, anything holding money or personal data, and anything expected to be developed further for years, is worth testing. A supplier who insists on full coverage for a two-week throwaway is not serving you, and one who skips tests on a system you will run for a decade is storing up a bill you will pay later.

More terms are in the glossary.

Portrait of Alexander De Sousa, founder of Digital Royalty
Founder-led
“I’ve put everything I know into how this company works — the standards, the method, the care on every project. It runs through the whole team, and I hold us all to it.”

Alexander De Sousa · Founder LinkedIn

Featured on BBC Radio Solent

Get started

Tell us what you need

A few quick questions, then a straight answer from a real person — usually within a few hours.

What happens next

  1. 1 We reply A real person reads your answers and gets back to you, usually within a few hours.
  2. 2 Questions or a short call If anything isn't clear, we ask by email or book a short call. Before any call we audit your website and make the quick fixes it finds, free.
  3. 3 Your fixed quote A clear, fixed price in writing, within 48 hours of any call. There is no obligation to go ahead.

Tell us what you're working on

Whether it's a new site, a platform, or a process that shouldn't be manual any more — we'll tell you honestly if we can help.