PHP Developers Network
http://forums.devnetwork.net/

Adding unit tests to an existing project?
http://forums.devnetwork.net/viewtopic.php?f=19&t=140865
Page 1 of 1

Author:  wdmartin [ Fri Jan 16, 2015 11:31 am ]
Post subject:  Adding unit tests to an existing project?

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?

Author:  Christopher [ Fri Jan 16, 2015 2:48 pm ]
Post subject:  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

Author:  wdmartin [ Fri Jan 16, 2015 4:30 pm ]
Post subject:  Re: Adding unit tests to an existing project?

That looks interesting, thanks! I'll check it out.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/