Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Self Testing Modules

by eyepopslikeamosquito (Archbishop)
on Dec 18, 2005 at 21:21 UTC ( [id://517621]=note: print w/replies, xml ) Need Help??


in reply to Self Testing Modules

Though you can do that in Perl, I can't recommend it as a "best practice" (in either Perl or Python) because it doesn't scale well as your module (and its tests) grow.

The recommended testing solution for Perl is Test::More (start by reading Test::Tutorial), and for Python it's PyUnit.

Replies are listed 'Best First'.
Re^2: Self Testing Modules
by BrowserUk (Patriarch) on Dec 18, 2005 at 21:28 UTC
    it doesn't scale well as your module (and its tests) grow

    Would you explain that?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      When writing a lot of tests, having one large monolithic block of tests can become difficult to manage. For example, with Test::More, it is more manageable to write many small .t files, rather than one large one.

        many small .t files

        I cannot tell you how much I disagree with that.

        You're suggesting that it is okay for the module to be a single file, but the tests for that module have to be littered around the file system in lots of tiny files?

        So now to test my module, I need a whole support harness to find, run, accumulate and report on those tests, adding layers to what should be the simplest code possible commensurate with getting the task done, and pushing a damn great wedge between the 'edit' and the 'run' in the development cycle.

        It takes the greatest benefit of 'interpreted' languages, the removal of the 'compile' step, and throws it away by substituting the 'test' step. And for what benefit?

        You now have to sit and wait for it to (re-run) all the tests of all code that you haven't changed, in order to gain a pretty number telling you "XX.X% passed", when what your really want to know is.

        Failure at line nn.

        And preferably, be dropped back into your editor, with that line highlighted. Running any tests after that failure is pointless, because like the warning issued by Perl when you omit a semicolon or brace, only the first one is real and the others are often as not cascade failures from it.

        It makes no sense to me at all.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found