Saturday, February 2, 2008

What is Unit Testing?

Agile software development processes require a foundation built on unit testing. To successfully integrate unit testing into the development process, a framework in which test suites can be created in parallel to application code is necessary. Developers should focus on creating unit tests that exercise system functionality with pass/fail results. The granularity of tests needs to be scrutinized in that one wouldn’t create tests for trivial operations and shun creating tests that have a high degree of coupling across the system. The ideal granularity is somewhere in between; to evaluate the function and system requirement driving that unit of code. The goal in integrating unit tests into the development process is to give developers a tool that they can leverage to quickly test large sets of system functionality during development. Further, that the growing set of unit tests become the regression test suite that are run as a “smoke test” after every automated system build out of the source control management system. Having a comprehensive set of tests is the keystone that gives developers the “courage” to take on re-factoring of existing code because they can immediately know whether they’ve broken functionality and specifically what is failing as a result of their actions.