Simple Smoke!

Derek Carter (goozbach)

http://blog.friocorte.com/presentation/

Testing (the why and how)

We test to know when things are wrong

Perl gave us a great protocol... the (then unamed) Test Anything Protocol "TAP"

1..5
ok 1 - one is one
ok 2 - one is not three
ok 3 - Foobar contains foo
ok 4 - Foobar does not contain baz
not ok 5 - Today is Tuesday
#   Failed test 'Today is Tuesday'
#   in bash-TAP/tap-functions:like() at line 313.
#     'Thursday' doesn't match 'Tuesday'
# Looks like you failed 1 test of 5.

TAP libraries exist in almost all languages

TAP (the protocol)

Extremely simple protocol

Has at least the following

may have the following

other advanced items

you can find a ABNF styled protocol draft at the Testanything WIKI

The Problem

Big Test suites are hard to manage.

Things get lost, or aren't easy to see.

The Solution

Various TAP::Formatter Modules

TAP::Formatter::HTML

Runs well by itself

#!/usr/bin/perl
use strict;
use warnings;
use TAP::Harness;

my @tests = glob( 't/*.t' );
my $harness = TAP::Harness->new({ formatter_class => 'TAP::Formatter::HTML' });
$harness->runtests( @tests );
    

TAP::Formatter::HTML -- External

To run externally you need to make some files avaliable

The easy way is to put these files in your webroot

TAP::Formatter::HTML -- External (cont)

Once you have your javascript and css files in your web root you need to modify your code to use them

my $formatter = TAP::Formatter::HTML->new;
$formatter->verbosity(-1);
$formatter->js_uris(['/jquery-1.2.6.pack.js','/default_report.js']);
$formatter->css_uris(['/default_page.css','/default_report.css']);
$formatter->force_inline_css(0);
$formatter->output_file( '/home/dcarter/projects/presentations/simple-smoke/test.html' );

my $harness = TAP::Harness->new({ formatter => $formatter });
      

Questions?

Thank You

The entire presentation can be found at:

http://blog.friocorte.com/presentation-storage/simple-smoke/