Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Test::Builder statistics

Journal written by Ovid (2709) and posted by brian_d_foy on 2008.01.12 15:53   Printer-friendly

In trying to give more control over how Perl programmers test their programs, I've had a couple of people tell me that I can't do that completely since so many people don't use the Test::Builder modules. I don't understand this objection. Why should I worry that someone who chooses to use X doesn't get the features that Y provides?

That being said, I decided to figure out some real numbers. I used CPAN::Mini::Extracted to extract the CPAN libraries and their tests to my hard drive. I then examined the test programs and tried to figure out which test modules programs were using. This is all done heuristically, but from my hand examination of results, it looks pretty close. I accidentally skipped my first time through, but here are the top ten testing modules (out of 287 used in almost 60,000 test programs) and the number of times each was used:

Test::More              44461
Test                     8937
Test::Exception          1379
Test::Simple              731
Test::Base                316
Test::Builder::Tester     193
Test::NoWarnings          174
Test::Differences         146
Test::MockObject          139
Test::Deep                127

From there, I wanted to figure out the percentage of test programs which used the Test::Builder framework, or something else. Again, these are generated heuristicically, but it's interesting:

Uses            Count  Percent
Test::Builder   47934   81.30%
Non-builder      1107    1.88%
Unknown           642    1.09%          8937   15.16%

It's not perfect, but this tells me that if someone provides new testing functionality and is willing to special case, you can capture almost 97% of the testing market on the CPAN.

Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.