Skip to content

Unit Testing Legacy Code

Photo of Richard Thomson
Hosted By
Richard T.
Unit Testing Legacy Code

Details

In Michael Feathers's book "Working Effectively With Legacy Code", he defines legacy code as any code without unit tests. Legacy code is difficult to work with because you never know if you're introducing new bugs when you make a change. The change could be a bug fix, a minor enhancement or a major new feature. Without automated tests, it can be difficult to know if we're making forward progress. We may be introducing bugs that are distant from the local area we are changing due to coupling and other non-obvious connections between code.

This month, Richard Thomson will guide us through a collection of strategies for testing legacy C++ code. The full details are presented by Michael Feathers in his book, but we'll discuss the basics and look at some scenarios and strategies that are specific to C++.

Some problems you can run into that make testing difficult:

  • My code is connected to API calls, e.g. global functions
  • My code is embedded in a UI class method
  • My code is connected to singletons
  • My code is connected to other classes
  • My code is in a private method
  • My code is in a private class, e.g. not exported in a shared object

Food will be provided, so please RSVP for an accurate head count.

Photo of Utah C++ Programmers group
Utah C++ Programmers
See more events