I was reading Petdances log (use.perl.org) and he summarised testing as .....
in reply to Testaholics Anonymous (or how I learned to stop worrying and love Test::More)
Never underestimate the power of one little test.
There is no such thing as a dumb test.
Your tests can often find problems where you're not expecting them.
Test that everything you say happens actually does happen.
If it's worth documenting, it's worth testing.
I asked him a few questions on his testing methodology and Andy answered back a few gems that you may find interesting ... (reproduced below).
- Think about what the code should do.
- Think about the API.
- Write the documentation for the code, explaining what the parms do.
- Write the test code that uses the API.
- Keep doing #3 and #4 until all the cases are covered. "Oooh, I hadn't thought of the case where a length is negative." So you type in the docs "If the length passed is negative, then a warning is thrown," and then write the test that tests that. Or vice versa.
- Write the code. You may go back to #3 and #4 as necessary because you think of more things as you write.
- Check it into CVS. Move on, knowing that you're covered.
What I get back from this is testing is soft of self discovery processing where testing allows you to enforce how your code should behave. At the same time uncover defects. Follow the links to see what modules are being used.