I was reading Petdances
log (use.perl.org) and he summarised testing as .....
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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||