Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Perl Testing and Quality Assurance

by Zaxo (Archbishop)
on Jun 02, 2003 at 08:20 UTC ( #262332=note: print w/ replies, xml ) Need Help??


in reply to Perl Testing and Quality Assurance

More difficult than choosing your testing toolset, you will need to decide what your tests should do. It's too late for coding to a specified test set ( which I completely agree with adrianh about - it's like magic ). Your code already exists and is in use.

I would begin by reviewing and rewriting the documentation. That will set in mind what the user interface is supposed to be like, what the internal API is to do, and will clarify the design in your memory.

Write user-level tests. In those, verify that the high-level documented interface works as advertised. Test erroneous usage for sanity. Then set these tests aside without fixing errors or improving anything.

Now start devising unit test of each sub. Your documentation of internals should guide you in what each should do, what error conditions may arise, and what tolerance each shold have for those errors. Do tests of each, from the bottom up. Induce error conditions to check for correct handling. Don't forget to test global data, too.

If your documents don't tell you what to test about a feature, that's a sign of probable hot spot. Study that closely and find out what the details should be.

Don't be too eager to change your design, but do keep an eye open for when you must.

After Compline,
Zaxo


Comment on Re: Perl Testing and Quality Assurance
Re^2: Perl Testing and Quality Assurance
by adrianh (Chancellor) on Jun 02, 2003 at 12:40 UTC

    All excellent advice.

    Another approach to determining what your tests should do is to see what you can remove from the code.

    Just delete a line or subroutine.

    Do all your tests still pass? If so one of the following is true.

    • You need to write another test to highlight the defect in the code you've just created.
    • You've found a feature that's surplus to requirements - well done you now have a simpler code base.

    God I love unit tests :-)

    You can even automate this sort of thing if you are that way inclined (see this interview where Java's Jester is discussed for an example).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://262332]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2014-07-28 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (195 votes), past polls