Engineering

Test-driven from the first commit

Tests written after the code is already working are tests written to pass, not to catch. They agree with whatever the code happens to do, bugs included. We write the failing test first — from the first commit, not the last sprint — so the test describes the behaviour and the code is made to satisfy it.

Coverage bolted on tends to lie

There is a common ritual near the end of a project: a push to raise the coverage number before launch. Tests get written quickly against code that already exists, and almost all of them pass on the first run. That is precisely the problem. A test that passes the moment you write it, against code you did not change, has proven nothing except that the code does what it currently does — including any mistake baked in along the way.

Real coverage is built up, not retrofitted. Each behaviour arrives with a test that would have failed before the behaviour existed, so the test earns its keep by having been red at least once. Do this from the first commit and the suite becomes a description of what the system is supposed to do — a thing you can trust to fail loudly when someone breaks it, which is the only reason to have it.

Two layers, both required

For an application, the two layers are the fast one and the honest one. Unit and component tests run in milliseconds and pin down logic in isolation; integration and real-browser end-to-end tests drive the actual system the way a person would — clicking through screens, submitting forms, watching data land in a database. Neither layer substitutes for the other. Fast tests miss the wiring; end-to-end tests are too slow to cover every branch. You need both.

Even a static marketing site has two layers. There are checks against the built output — validation, accessibility, a performance budget, a link checker, a guard that the copy still mirrors the canonical source — and there is a real browser loading each page and exercising every call to action. A green screenshot of an empty form is not coverage; the form has to be submitted against a test endpoint and the success state asserted. A passing picture never proved a thing worked.

The discipline, and the proof

The rule is simple to state and unforgiving to keep: the failing test comes first, every time, in the same change as the code. That ordering is what makes coverage grow with the product instead of being negotiated onto it at the end. It also changes how the code gets designed — code written to be tested is code with seams, and seams are where a system stays soft enough to change.

Our own products are built this way, which is why we are comfortable pointing to them rather than to a certificate. When we build custom software, the same standard travels with it — see Docusift for a live example, and read how we think about building intelligence in on AI-native app development.

Questions

People also ask

    Why write the test before the code?

    So the test has been red at least once and genuinely describes the intended behaviour. A test written after the code already works usually just agrees with the code — bugs included — and proves nothing.

    Do static sites need tests too?

    Yes. A site has two layers: automated checks against the built output — validation, accessibility, performance budget, link and copy guards — and a real browser that loads each page and actually submits every form against a test endpoint.