Book a call

Modernization

Characterisation tests are the only safe way to start a migration

Before moving a line of legacy code, write tests that describe what it currently does — including the behaviour you think is a bug. Here is how we do it.

The most dangerous moment in a legacy migration is the first commit, because at that point nobody can prove what the system did before you touched it.

Characterisation tests solve this. They are not tests of correct behaviour — they are tests of current behaviour, written by observing the system rather than by reading a specification. If the legacy code rounds a total in a way that looks wrong, the test asserts the wrong rounding. Preserving the bug is the point; discovering it during migration is not.

Writing them without reading the code

The trick is to treat the existing system as a black box. Take a real input, run it, record the output, and assert on the recording. For a WebForms application that usually means driving it through HTTP and asserting on the rendered response. For a service layer it means capturing a production request payload and its response.

The tests will be ugly. They will assert on whole objects, whole payloads, whole pages. That is correct at this stage — a broad, ugly assertion catches a regression that six precise ones will miss.

When to stop writing them

You do not need coverage of the whole system. You need coverage of the slice you are about to move, plus everything that slice touches. That is a much smaller number, and it is reachable in days rather than months.

Then move the slice, run the suite, and let the diff tell you what changed.

Keep reading

More engineering notes

All notes
  • You cannot improve a RAG system you are not measuring

    An evaluation set of real questions with agreed answers takes about a week to build and is the difference between improving a retrieval feature and having opinions about it.

    You cannot improve a RAG system you are not measuring
  • Most teams do not need Kubernetes, and the bill proves it

    AKS carries a permanent operational cost that App Service and Container Apps do not. Here is the decision we actually use when choosing Azure compute.

    Most teams do not need Kubernetes, and the bill proves it

Have a project in mind?

Tell us what you are building and we will tell you honestly whether we are the right team for it.