DEV Community

Discussion on: Are old unit tests useful?

Collapse
 
jfrankcarr profile image
Frank Carr

I work with a lot of legacy code that rarely has any tests associated with it. I often wish the original developers had written unit tests I could use, even if these tests had less than ideal coverage or clarity. The way it works now, I have to spend a lot of time trying to figure out stuff that a simple battery of tests would explain, especially now that almost all of the original developers are no longer around.

For my own personal code, I like having a unit test project where I can easily verify the changes I'm making don't break anything and regain understanding of what I had written. For example, just this week I dusted off a component I had written about 5 years ago to get some ideas for a new project that's in our backlog. Running through the tests allowed me to quickly become reacquainted with the code and how it worked.