Understand Legacy CodeChange Messy Software Without Breaking It

Approval Testing

I need to change this code, but it has no test!

This is the title of a talk I gave at ConFoo 2020. Can you relate?

I present a technique known under different names:

  • Approval Tests
  • Characterization Tests
  • Golden Master
  • Snapshot Tests

The purpose of the technique is to capture the existing behavior of system to create regression tests that will tell you if it changes.

It's used to quickly put Legacy Code under tests so you can refactor it safely.

📖 Synopsis

Have you ever felt helpless, facing some cryptic code you had to change? You know, the kind of code that has no test to tell you if something breaks…

This is a scenario I frequently faced. And I learned better ways to work with such Legacy Code.

In this session, I'll show you how to write tests on existing code, even when you don't understand what it does. You'll learn how to modify this code and know that nothing broke when you’re done.

🧰 Resources

🎓 Related articles

Nicolas Carlo

Written by Nicolas Carlo who lives and works in Montreal, Canada 🍁
He founded the Software Crafters Montreal community which cares about building maintainable softwares.