There has been a marked surge of interest in coverage testing recently, and Perl has excellent support for this aspect via Paul Johnson's excellent Devel::Cover.

I installed this module about 2 months ago and, despite articles like How to Misuse Code Coverage, that don't recommend trying to achieve 100% coverage, I thought I have a bash at it, and see what I would learn.

It wasn't easy to get to 100% coverage, especially when different platforms are taken into consideration. But I did learn a lot. And I found numberous issues with what I had (before the exercise) thought was solid, well designed and tested code (there was already >700 test cases across the 2 libraries).

In no particular order, things I found were

The lessons I learnt (or were reinforced) were

Whilst I wouldn't state that getting 100% coverage is required by everyone, just the exercise of attempting it can be revealing.

We've just had one of our developers finish a new library, and that currently has 92% coverage. We plan to get the rest of us familiar with the new API by having each developer extend the coverage tests by 1-2% each. Eventually everyone will have had to write a little code using the API, which is the best way to learn it.

use brain;


In reply to Lessons learned from getting to 100% with Devel::Cover by leriksen

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.