As a developer, when you focus on get your piece of code fast & working good, we usually don’t think on create the Unit Tests, but we test it! (tray -> fail => (and finally) sucess). And just at that moment we think is all clear and proceed with our next task or proceed to publish on production environments. Behind all that “complete task” we haven’t left a think for the future (except the funcionality) but in some cases we need to perform some update, the bussiness model changes or we want to add some cool stuff to our piece of code, and that is where really comes to you and make you suffer.
All that problem could has been solved by creating Unit Test, when you think what are you going to test you make an analysis that can be pushed to its limits on all the possibilities of a little piece of code, and if you save your test, you can re-run them and try all that path without think on them again, that when you save time, save effort and money.
To create test on early stages will cost you some effort at the beginning but when you have a high percentage of your system created you will save tons of time on testing everything.
There are many tools to create unit testing, the isn’t any magical way to create everything, you will have to complete the body of them, the tools helps to confirm the data tested and even create reports of the tests ran.
Some techniques to perform this test are: Replace & Override / Fake Delegation.
From the moment that you create your test you will improve your programming skills. On some other post will create simple test cases to show you.