A Test-Infected Culture

| 3 Comments

Many people consider the CPAN the shining gem of Perl 5. As of this writing, it contains more than 53,000 modules in more than 17,400 distributions with 7316 registered authors. That's a lot of code.

Many people outside of the Perl community don't realize the implications for a centralized infrastructure which allows people to upload, install, read documentation, annotate, report bugs, request features, submit patches, and collaborate on improvements to every one of these distributions. The CPAN isn't just a repository of freely-installable libraries. It's the hub which makes so many of modern Perl's amenities possible.

First, a brief history lesson.

1987

Larry released Perl 1 in 1987. If you download Perl 1 source code (you can build it today), you'll see that it contained a rudimentary but working core test suite. The separation of concerns evident between running tests and interpreting the results is still useful today in the form of the Test Anything Protocol.

1994

Perl versions 2 through 5 continued the language testing culture. The core language had a self-hosted test suite (and still does). Many CPAN modules at that time used a program called h2xs to generate that boilerplate -- and part of the boilerplate was a program called test.pl which contained some "scary black magic -- do not edit" to set up a testing infrastructure.

1998

In 1998, Chris Nandor and Graham Barr created a CPAN Testers project to run the test suites of CPAN distributions and report their results. Remember this.

The 21st Century Testing Revolution

After the Perl 6 announcement in 2000, Michael Schwern agreed to lead the QA working group. He resolved to improve the coverage of the core test suite and the coverage of the core libraries (which was less than optimal). As part of this process, he wrote Test::More and Test::Simple to hide the black magic from users and to make tests easier to write.

This started a revolution, but the world changed when he refused to add features to Test::More, claiming that it was more important for people to write their own testing modules. At his suggestion, I extracted the reusable logic from Test::More and created Test::Builder, which for the first time allowed multiple test modules to run in the same process and collaborate to produce TAP.

The revolution had begun.

Perl QA spent the next couple of years teaching people how to write good and comprehensive and working and useful test suites. We quadrupled the number of tests in the Perl 5 core from the release of Perl 5.6.0 to 5.8.0, and that number has only increased.

Can Your Language Community Do This?

That brings us to the present day. The CPAN Testers project is almost eleven years old. According to the monthly CPAN Testers statistics, there have been over three and a half million reports posted. Activity was low until late 2006, when the number of test reports submitted exploded (see CPAN Testers Statistics Graphs). Though 3.5 million reports over eleven years doesn't sound like a lot, the current testing rate produces well over a million reports a year (perhaps closer to two).

There are even plugins for the CPAN and CPANPLUS distribution installation libraries to report any test failures when you try to install a distribution -- testing those distributions you need the most.

Anyone who uploads a distribution to the CPAN will have it tested on several hardware platforms, on multiple versions of Perl, and on multiple operating systems. These reports are gathered and aggregated and displayed on the CPAN Search page for that distribution. A related project also analyze the probability of a given distribution installing on your platform (taking into account the reports for all of its dependencies, recursively).

Imagine knowing that your code works on platforms you can't access, because people who know those platforms have set them up to give you frequent and accurate feedback.

The Perl 5 language itself has daily smoke reports (though not produced through CPAN Testers), as does the Parrot virtual machine and the Rakudo Perl 6 implementation. All of the infrastructure and experience from testing Perl 5 effectively is going into the specification tests for Perl 6.

Granted, the usefulness of all of this infrastructure depends on people using it and writing good tests, but I know of no other language community which has even attempted a project of this size. Do you?

3 Comments

Why does www.cpan.org list "7288 authors 15485 modules" whereas search.cpan.org lists "67310 Modules, 7316 Uploaders" (as at 2009/04/09)?

The author of http://www.bitcetera.com/en/techblog/2009/04/07/10-reasons-why-php-is-still-better-than-ruby--/ seems to think the 15000 means that Ruby will shortly overtake Perl. He might not be so confident when he sees 67000.

That's a good question. cpan.org might take its numbers from the unused DSLIP classification system that predated search.cpan.org's current utility. That's just a guess; I can try to find out.

I believe it's distributions vs. packages. There are 15,000 and change rows in 01modules.index.html; there are 65,000+ rows in 02packages.details.txt.

Modern Perl: The Book

cover image for Modern Perl: the book

The best Perl Programmers read Modern Perl: The Book.

affiliated with ModernPerl.net

Categories

Pages

About this Entry

This page contains a single entry by chromatic published on April 8, 2009 11:21 AM.

The Rapid Release Tautology was the previous entry in this blog.

Relentless Progress (Rakudo Version) is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.


Sponsored by Blender Recipe Reviews and the Trendshare how to invest guide

Powered by the Perl programming language

what is programming?