Unit Testing

23 08 2008

Unit testing should always be on your mind while you’re coding. Some people prefer to write the unit tests before the code that’s being tested. However I prefer to write mine afterwards. It’s a personal preference and each to their own. But which ever way you feel, unit tests are good. Unit tests are your sanity check, and a direct link to the reason you’re writing the code. If you have no unit test for a particular piece of code, ask yourself if that piece of code is necessary. If not, discard it. If it is necessary, then why haven’t you written a unit test for it? Hmmm? Go write one now then, before you forget about it…