So I'm working on this web project that has a custom test harness and nightly automated tests. Right now it runs the tests using Test::Harness, captures the output and then emails it to everyone on the mailing list for the project. It's worked really well so far, but the output is kinda plain and because there are 96 test files, and 3000+ individual tests the test output is a little hard to skim
quickly in the morning to make sure everything worked...
This module will run the desired tests, record the output from any TAP
compatible tests (eg, anything using Test or Test::More, etc) and then format them into nice, pretty and colorful HTML results.
So I decided to try and capture this out and send out a multipart email using MIME::Lite
. And the code looked something like this:
# create the TAP model to run and capture the
# TAP test output
my $model = Test::TAP::Model::Visual->new();
# now get the HTML output
my $matrix = Test::TAP::HTMLMatrix->new($model);
my $output = $matrix->html();
# now send it in an email
my $msg = MIME::Lite->new(
From => 'email@example.com',
To => 'firstname.lastname@example.org,
Subject => 'Automated Test - ' . scalar(localtime),
Type => 'multipart/alternative',
Type => 'text/html',
Data => $email_output,
Pretty simple huh? But darn cool.