in reply to Re: Testing Question
in thread Testing Question

I find debugging output really helpful during development. I don't want to write-remove-write-remove debugging code ad-nausium. Plus, I often find that my problem really comes from somewhere other than the place where the symptoms are. If foo($thing) is breaking, but the problem is in the part that created $thing, I'd be much better off with complete debugging output, rather than having to put a bunch of stuff into foo(), just to discover that I need to put a bunch of stuff elsewhere. With reasonable debugging output, I'd already have both.

Thanks for the pointers on prove and diag!

Replies are listed 'Best First'.
Re^3: Testing Question
by tirwhan (Abbot) on Feb 24, 2006 at 19:56 UTC
    If foo($thing) is breaking, but the problem is in the part that created $thing

    Then this should be caught by the tests for that part. That's kinda my point, by relying on debugging output which you inspect manually you're hiding the complexity of your program and missing out on vital tests. You are obviously smarter than your test suite and you can reason "ok, this is the output I was expecting, because I know of this side-effect which I'm not testing for otherwise". But this grows too complicated really quickly and IMO it'd be much better to write simple tests for everything so there are no untested side-effects. This way you don't risk missing out on an unexpected value.

    Obviously we all have our own methodology and I'm not trying to foist my way of thinking on you or tell you that you're wrong. Just trying to explain how I've found things work best for me.


    All dogma is stupid.

      ++

      Good points!

      So, if I can bother to write a 'print' statement, I can bother to write a test, is basically what you're saying. That coupled with the diag() function in Test::More will go a long way...

      I think what I really need to do is use the perl debugger more. If I wrote tests like you say and ran them in the debugger, I'd get everything I wanted.