This post originated from an RSS feed registered with Web Buzz
by Douglas Clifton.
Original Post: PHPUnit
Feed Title: blogZero
Feed URL: http://loadaveragezero.com/app/s9y/index.php?/feeds/index.rss1
Feed Description: Web Development News, Culture and Opinion
While I may not take a formal, academic approach to software development methods, I am a big fan of unit testing. Programmers who design, code and then build a complete application before doing any testing baffle me. In general, my approach (which should sound familiar) is to break a large project down into logical and manageable components, then further break these down into discrete parts that are related to a one or two data structures. The data could be based on XML, but more often it is an SQL database that represents the entire project. My next step is to design and write one function or method at a time, and immediately test the function to make sure it behaves as expected. I will repeat this procedure until that module is complete, then test the module as a whole. After all the modules are complete, I begin testing to make sure they all interact as designed.
Then it's time to throw the thing to the wolves—some users. Mixed in to all of this are testing issues not necessarily related to logical or other errors (bugs), but perhaps usability problems, missing or new features, and so on. I have found that this unit testing and iterative process much more effective than a monolithic approach.
If you are looking for some pointers on automating the process of unit testing with your PHP projects, consider Sebastian Bergmann'sPHPUnit. The complete book is available online, and the pocket guide is only $10 US.
Along with unit testing, I'm also a huge fan of these O'Reilly "pocket rockets."