Course with Llewellyn

Llewellyn — How to Write Unit Tests for Legacy Code

How to write unit tests for legacy code, 1:1 with a tutor that rejects tests which only assert a mock was called. Four weeks on characterisation tests, seams and database fakes, ending when a pull request fails loudly on changed behaviour.

What you’ll master — Outcomes you can use

  1. Tests a reviewer trusts, without a rewrite
  2. Their pull request fails loudly on changed behaviour and passes unchanged after a refactor

Your tutor

A staff engineer who pulled a decade-old billing module under test without rewriting it.

Patient · Opinionated about pytest

The plan — What’s inside

  1. Characterisation Tests Before You Change Anything
  2. Cutting the First Seam
  3. Faking the Database Without Mocking Everything
  4. Choosing What Not to Test

4 parts

Questions about this course

How do I write unit tests for legacy code with no seams?

How to write unit tests for legacy code, 1:1 with a tutor that rejects tests which only assert a mock was called. Four weeks on characterisation tests, seams and database fakes, ending when a pull request fails loudly on changed behaviour.

All Coding & Data templates · All templates