OK, so as to your question(s) - are you testing "too much"

I have strong opinions on this, based on years of writing code that has experienced jut about every failure mode imaginable.

I have a personal belief that you have tested enough when you feel you have exercised as much of the code as you reasonably can. I use Devel::Cover to tell me how much I haven't done, and use my experience and judgement to make informed decisions as to what tests I will add for the remains.

For example, do you need to test what your code does if read() fails ? If so, writing test cases to do this is a bit difficult, but if you need it, do it.
Otherwise, code and test on the assumption "read() will never fail" and move on.

Devel::Cover isn't perfect, and sometimes it can be very difficult to work with - for example, it complains about my $class = ref($proto)||$proto; as having an untested path in most "reasonable" usages. You have to write a test that calls the constructor in a manner you would expect to see for a function-based module e.g. Module::new(), not Module->new()
So you need to ask yourself "is testing for people calling my OO methods as normal functions something I want to do ?"

If it is important to you, you help newbies who do "Module::new" by mistake.

If not, ignore the report of the untested path from D::C and move on.

As an aside, I wrote a meditation on what I had to go through to get a reasonably large body of modules to get to 100% coverage as reported by D::C - see Lessons learned from getting to 100% with Devel::Cover about my struggles and discoveries from doing a deep testing effort.

...reality must take precedence over public relations, for nature cannot be fooled. - R P Feynmann


In reply to Re^5: too much testing? by leriksen
in thread too much testing? by geektron

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.