Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
moritz,
The title doesn't really match what is being asked. A more appropriate title might have been "How to retrofit a test suite to a complex application". From that perspective, I might address the question from a different angle. The rest is meant more for the OP than for you - but it is meant in context of your response.

What are you hoping to accomplish? Do you have some significant changes coming up and you want to be sure you don't break anything? Do you suspect that over time the application has evolved and you are unsure if all the business requirements are being met? Perhaps you think there is a lot of "dead code" that can be pruned. Do you have the luxury of devoting yourself to this full time or do you need to take a more iterative approach?

Now that you know what your motivation is, is testing where you need to begin? There is a good chance that, if there is no test suite, then there is likely no or ill defined requirements. Backing into requirements can be as much "fun" as backing into testing. Since there are a myriad of different types of tests you can run (see Software testing), you will at a minimum want to make sure you are meeting your business requirements. If you can, don't look at or even think about your code when documenting these requirements.

Since this is an existing large and complex application, you can start by writing tests for individual subroutines. Keep your business requirements handy as a checklist. If the subroutine assumes some other function performed correctly, write the test that way too (even if you haven't looked at that code yet). In other words, don't be afraid to write a test that you know or are unsure will fail. The test is the correct behavior so failures will help you find bugs.

A missing test suite is an indicator of other problems (like lacking requirements). It may be beneficial to read through Re: Refactoring a large script to see if any of those other things apply as well.

Cheers - L~R


In reply to Re^2: how to begin with testing? by Limbic~Region
in thread how to begin with testing? by stinkingpig

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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:
    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
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (13)
    As of 2014-07-10 16:52 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (213 votes), past polls