|laziness, impatience, and hubris|
Lessons learned from getting to 100% with Devel::Coverby leriksen (Curate)
|on Jul 30, 2004 at 03:58 UTC||Need Help??|
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.