An 8-line start, and then tiny steps

dws on 2005-05-11T01:41:10

It's surprising how far you can get in one day by starting with

#!/usr/bin/perl -w
use strict;
use Test;
use WWW::Mechanize;

use constant STARTING_URL => 'http://localhost//notyetbuilt.cgi';

my $agent = WWW::Mechanize->new();
$agent->get(STARTING_URL);
ok( $agent->status, 200 );

and then writing just enough CGI code to make that first little test pass, and then by writing the next test, and then writing just enough code to make that pass, and so on. Tiny step by tiny step.

By the end of the day, what looked like two days of work is nearly done, with good functional test coverage. Add unit tests on the other side, as appropriate.

Replace Test with Test::Simple or Test::More as your preferences dictate.

A shout out to Andy for a fine piece of work on WWW::Mechanize, which made quick work of driving form development.


Test::Test::1::2::Microphone::Check

Aristotle on 2005-05-11T13:15:28

Replace Test with Test::Simple or Test::More as your preferences dictate.

Or with Test::WWW::Mechanize? :)

Shouts

petdance on 2005-05-15T00:32:29

Thanks for the shouts. Change to this:

my $agent = Test::WWW::Mechanize->new(); $agent->get_ok(STARTING_URL);