I have a moderately large app (about 67K lines of code) that I've written over a period of years. The code is clean, commented religiously, and the program architecture is reasonably modular despite not using an OOP approach. It's in production use at my workplace, and has proven generally reliable.
When I began working on it in 2007, I'd never heard of unit tests, and though I've since learned about them in theory, it has seemed easier to keep going without them than to go back and figure out a testing suite for the already fairly complex app.
But in the interests of long-term stability, a test-driven approach seems like a good idea, so I should probably bite the bullet and do it. But it seems pretty overwhelming. Can anyone offer tips or resources on how to add unit tests to a large existing project that wasn't built around the methodology?
Adding unit tests to an existing project?
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Adding unit tests to an existing project?
Writing tests from the core out might make sense, but you need to ask yourself what you would get out of it. Are there areas of the codebase that are unstable or change often. Having tests for those areas might make changes and refactoring safer.
There is a fairly new book that might be of interest to you: https://leanpub.com/mlaphp
There is a fairly new book that might be of interest to you: https://leanpub.com/mlaphp
(#10850)
Re: Adding unit tests to an existing project?
That looks interesting, thanks! I'll check it out.