Cincinnati Ruby Brigade: Characterization Tests

During the April 2021 meeting of the Cincinnati Ruby Brigade, Gaslight’s VP of Development Tim Mecklem walks us through writing Characterization tests as a means of dealing with a legacy codebase. Big shout out to Michael Feathers and his book, “Working Effectively with Legacy Code” which lays out the foundation of Tim’s approach.

  1. Use a piece of code in a test harness (an RSpec test in our case)
  2. Write an assertion you know will fail.
  3. Let the failure tell you what the behavior is.
  4. Change the test so that it expects the behavior that the code produces.
  5. Repeat.

You can find the code here on GitHub. Watch the meeting video here:

Dealing with a legacy code base that is difficult to maintain, manage or promote? Our team can help. We should talk.

Related Posts

Want to learn about the types of products we build?

Check out our projects

Like what you're seeing? Let's keep in touch.

Subscribe to Our Newsletter