Monday, March 30, 2009

Smoke testing Perl with Test::TAP::HTMLMatrix

Testing is Great Fun, but what is the point if you can't impress your boss with a great-looking report?

I remember looking at the smoke-test-reports for Pugs several months ago, wondering "How did they make these great test reports?"

Well, it's pretty easy. Yuval Kogman, a prolific Perl module author, has created Test::TAP::HTMLMatrix.

This image is a screenshot of the kind of reports you can get from Test::TAP::HTMLMatrix. Each test name is hyperlinked to the test file itself. This example was created with the following script:


use strict;
use warnings;

use Test::TAP::HTMLMatrix;
use Test::TAP::Model::Visual;
use Test::TAP::Model::Consolidated;

# make a successful test run
my $model_ok = Test::TAP::Model::Visual->new_with_tests(
$model_ok->desc_string("real run");

my $v = Test::TAP::HTMLMatrix->new(
Test::TAP::Model::Consolidated->new( $model_ok )

# this is the most popular view:
print $v->detail_html;

I run it like this:
perl > smoke.html


Wolf said...

Perl is the best scripting language for Text processing and handle regex. I have posted few articles related to those at my blog

Also Perl's Cpan has lots of support that I don't even need to think extra while developing project. I didn't find such help on other programming language except Java and .NET