I started making use of unit testing. Unit: smallest testable part of an application. At first, I was a little bit sceptical. "This tests are way too simple" I said to myself. But as the project grew in size, I realized the assurance my unit tests provided. They were the first line of defense against bugs. It allowed me to try new things with my code without being afraid of blowing things up.
My advice to the sceptical is: You write temporary little tests to check your code anyway. Instead of throwing them away, arrange them into unit tests. If nothing else, your unit tests will serve as a written reminder of what you have tested, and -more importantly- what you have not.
The Developer Testing Paradox by Alberto Savoia:
"When developers concentrate their efforts on unit tests, QA can focus on its real job – system and integration testing, load and stress testing, and independent verification – rather than having to find unit-level bugs that developers should have already caught and fixed."
"Left unchecked, a relatively small number of unit-level bugs can easily multiply and impair a software system so insidiously that bringing it back to a reasonable level of quality and usability may be impossible or, at best, horrendously painful and expensive. If you don’t pay attention to bugs early enough, you can easily end up with a system that is such a nightmare to maintain, evolve, and yes, even test, that the best option may be to throw it away and start over."
"...a single unit-level bug can infect the system and manifest itself in many other modules, forcing the QA organization to submit multiple bug reports – each of which takes valuable time to reproduce, file, verify, etc."
"If the tests are not executed frequently enough (ideally several times a day, matching the rhythm of code changes), much of their effectiveness will be lost."
"Test failures are a very good thing. They are evidence that the tests are thorough and are doing their job of detecting bugs and changes in the code behavior which, left unaddressed, could lead to further and more serious bugs."
"There is nothing like the feeling of confidence and protection that we get by having tens of thousands of test points spread across numerous tests that are run several times a day. System and integration tests are still necessary and useful, but they can’t match the fine granularity, resolution, and assurance of having specialized tests for each unit of code."