What should you test? Before you begin, write a list of all the tests you know you will have to write. The first part of our approach to dealing with programming stress is never to take a step forward unless we know where our foot is going to land. When we sit down to a programming session, whit is it we intend to accomplish?
Test-Driven Development - Kent Beck, page 126 paragraph 2Finally, we'd like to reveal the single most important concept in testing. It is an obvious one, and virtually every textbook says to do it this way. But for some reason, most projects still do not.
If a bug slips through the net of existing tests, you need to add a new test to trap it next time.
Find Bugs Once.
Once a human tester finds a bug, it should be the last time a human tester finds that bug. The automated tests should be modified to check for that particular bug from then on, every time, with no exceptions, no matter how trivial, and no matter how much the developer complains and says, "Oh, that will never happen again."
The Pragmatic Programmer - Andrew Hunt, David Thomas, page 246 paragraph 6After you have written a test to detect a particular bug, cause the bug deliberately and make sure the test complains. This ensures that the test will catch the bug if it happens for real.
If you are really serious about testing, you might want to appoint a project saboteur. The saboteur's role is to take a separate copy of the source tree, introduce bugs on purpose, and verify that the tests will catch them.
The Pragmatic Programmer - Andrew Hunt, David Thomas, page 244 paragraph 6