Benefits of unit testing

One of the biggest benefits of using unit tests on a legacy system is that it facilitates making modifications to the system, particularly for individuals who may not be familiar with the system. As you make changes to a legacy application, unit tests will ensure that the changes did not introduce new defects and that the functionality still works properly.

Regularly executing unit tests, such as after a change is made or as part of the build process, will make debugging any issues that are found easier. A developer will be able to narrow down the source of the problem to one of the recent changes.

The documentation for legacy applications may not be suitable but if the system has a good suite of unit tests, the tests can serve as a source of documentation. They help team members understand the system and allow them to learn what a particular unit of code was developed to do. When unit tests are lacking, just the act of writing the unit tests will help the team become more familiar with the codebase.