DDD Europe 2023 - Program

Refactoring Legacy Code Guided By Approval Tests

Main Conference - Hands-on Lab


Jan Van Ryswyck

Jan Van Ryswyck
Friday 9 from 14:30 until 16:30 in Room 3

(This is a hands-on lab with limited capacity)

You’ve been asked to add a new feature to an existing application. After some investigation, it turns out that the design of the code is far from optimal. There are also no automated tests to help you. Sounds familiar? So you set out to add some tests, but that requires refactoring the code. However, in order to refactor the code you need have tests in place. How do we break free from this cycle?

In this hands-on workshop you will learn how to use Approval Tests for testing legacy code using an outside-in approach. You’ll be able to practice how to safely refactor the code while also adding fine-grained unit tests and eventually introducing a new feature.


This workshop is for software developers who already have basic knowledge about writing automated tests and refactoring code. The code exercise used during this workshop is available in C# or Java.

Having a good understanding of the following topics will definitely make the most out of this workshop:

  • A decent understanding of an object-oriented programming language, preferably C# or Java.
  • At the very least some first experiences writing unit tests for production code.
  • Basic or intermediate knowledge of an xUnit test framework.
  • Basic or intermediate knowledge of a mocking framework.

Participants should bring a laptop with a C# or a Java development environment preinstalled.

About Jan Van Ryswyck

Twitter LinkedIn Blog Company Website Sessionize

I'm a professional software developer since Y2K. A blogger since Y2K+5. Author of the book "Writing Maintainable Unit Tests". Provider of training and coaching in XP practices. Curator of the Awesome Talks list. Thinking and learning about all kinds of technologies since forever.