Testing First (TDD)
Test as you write the code.
Write automated tests.
Why and when does this make sense?
- When testing in small steps most errors can be quickly traced back to their origin
- Testing manually is boring - awareness quickly decreases and errors slip in unrecognized
- Testing manually is slow compared to automated tests
- Automated tests give confidence while refactoring
(Also components of electronic devices are typically tested before they are assembled to more complex units.)
Books and Articles
-
Among the most recommendable surely is the classic from Kent Beck:
Test Driven Development: By Example, 2002, ISBN 0-321-14653-0 -
And of course, as he is another big TDD proponent:
linking to Martin Fowler's entry page for TDD is a "must" here
Quite surely, there are many good readings on TDD at all levels and therefore it is not understandable to me why - and this is not made up, it actually happened to a close friend - a software developer was forced by the project leader to code for weeks and months without being allowed to do even a single test of any line of code she had written! You can bet: you would have seen me running out of this shop yelling loud the second or third day ... :-)