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
- Tests a reviewer trusts, without a rewrite
- 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
- Characterisation Tests Before You Change Anything
- Cutting the First Seam
- Faking the Database Without Mocking Everything
- 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.