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

Re^5: Self Testing Modules

by demerphq (Chancellor)
on Dec 18, 2005 at 23:34 UTC ( #517634=note: print w/replies, xml ) Need Help??


in reply to Re^4: Self Testing Modules
in thread Self Testing Modules

Personally I think it makes a lot of sense to split up your tests into seperate files, preferably based on the type of testing that will occur. When your tests start being more code than what is being tested having it all in one file doesnt make a lot of sense. I mean at the very least if your code is 100 lines, and your tests 1000 (a not unreasonably ratio IMO) then if you embed your tests in the same file thats 900 lines of code that will be read and parsed and compiled for no reason every time you use the module.

And frankly if you are using the test framework to get a pretty number telling you "XX.X% passed" then you aren't using the test framework properly. The issue is to find out what failed not what passed. Having the tests broken down into test files grouped in some sensible way, a failure from a given file can itself be enough information to start investigating. Having the actual test name is even better.

Anyway, i dont expect youll change your views based on my comments, but hopefully other readers will learn something from this.

---
$world=~s/war/peace/g

Replies are listed 'Best First'.
Re^6: Self Testing Modules
by BrowserUk (Pope) on Dec 18, 2005 at 23:57 UTC
    ... if your code is 100 lines, and your tests 1000 (a not unreasonably ratio IMO) ...

    If you are writing 1000 lines of tests to verify 100 lines of code, your code is testing your tests, and not the other way around.

    And frankly if you are using the test framework to get a pretty number telling you "XX.X% passed" then you aren't using the test framework properly.

    It isn't a case of what I'm doing, it's what they do--and the reason I don't use them!

    Anyway, i dont expect youll change your views..,

    Nor do I expect others to eshew de rigueur based upon my rejection of it, but counterpoint is a goood thing wouldn't you agree?


    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.

      If you are writing 1000 lines of tests to verify 100 lines of code, your code is testing your tests, and not the other way around.

      Heh, well, ok, maybe thats a bit high. :-) OTOH, A hundred lines of code can involve an awful lot of behaviour that needs testing, especially in perl, and IME test code tends to be quite chunky anyway. Maybe stating a hard and fast ratio is not so easy, but i believe the point is still sound.

      ---
      $world=~s/war/peace/g

      It isn't a case of what I'm doing, it's what they do--and the reason I don't use them!

      XX.X% passed is not the only information you get out of a T::B based test suite. It's certainly not the information I'm focused on when I'm developing.

      All I'm looking for is whether the last test I wrote passed or failed. Personally I find that the existing tools give me this info pretty easily. Especially now that Test::Builder displays the test description so that it can be read without dropping into verbose mode.

      The only place I find this information more tricky to find, sad to say, is with my own Test::Class - and I'm working on fixing that :-)

      This isn't to say the pretty numbers and statistical summaries are completely useless. While it's not of much relevance during development, it can be a useful diagnostic tool at install/distribution time.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2021-06-23 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (117 votes). Check out past polls.

    Notices?