Header image
Photo of Clare Macrae

Clare Macrae

Clare has worked in technology for over 30 years, and is a Principal Scientific Software Engineer at Cambridge Crystallographic Data Centre. She currently leads the team that’s replacing their 30 year old database format. When not thinking about supporting teams to streamline development and releases, she spends time with family and friends, and more recently, also contributes C++ code to the CycleStreets journey planner.

Quickly testing legacy code

Tuesday 14:45
60 minute presentation
Intermediate
Beginner

You've inherited some legacy code: it's valuable, but it doesn't have tests, and it wasn't designed to be testable, so you need to start refactoring! But you can't refactor safely until the code has tests, and you can't add tests without refactoring. How can you ever break out of this loop?

I will present a new C++ library for applying Llewellyn Falco's "Approval Tests" approach to testing cross-platform C++ code - for both legacy and green-field systems, and a range of testing frameworks.

I will describe its use in some real-world situations, including how to quickly lock down the behaviour of legacy code. I will show how to quickly achieve good test coverage, even for very large sets of inputs. Finally, I will also describe some general techniques I learned along the way.