16 April 2021
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.
- Use a piece of code in a test harness (an RSpec test in our case)
- Write an assertion you know will fail.
- Let the failure tell you what the behavior is.
- Change the test so that it expects the behavior that the code produces.
- 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.
Heads up! This article may make reference to the Gaslight team—that's still us! We go by Launch Scout now, this article was just written before we re-introduced ourselves. Find out more here.