|
From: <me...@st...> - 2005-04-07 14:12:21
|
My $client wanted to upgrade CGIP, but because the new version of Mecha
requires a newer version of LWP, and $client didn't want to upgrade LWP,
I split Mecha out as a separate distro.
You need CGIP to use Mecha. You need Mecha to *fully test* CGIP, but
the tests are marked as optional. Thus, this should permit non-Mecha
users an installation path.
Frankly, I think Mecha rocks. I get to write tests that step through
the app like I would with Mechanize, and then talk directly to the
database in the same process to see what the results are.
Here's a snippet from a $client test:
ok $m->submit_form
(fields =>
{managers => "test1\ntest2",
members => "test3\ntest4\ntest5",
},
button => 'update alias',
), 'populate initial list';
ok $m->success, "fetched manage alias page" or $m->diag_response;
## verify database is in proper state
{
is my ($a) = Alias::DB::Alias->search(name => 'one-test'),
1, 'found one alias named one-test';
is my @managers = $a->managers, 2, '2 managers found';
is_deeply
[sort map { $_->ubit } @managers],
[sort qw(test1 test2)],
'managers ubits are OK';
is my @members = $a->memberships, 3, '3 members found';
is_deeply
[sort map { $_->email } @members],
[sort qw(test3 test4 test5)],
'members email are OK';
}
So, I'm poking at the application through the "web", then
immediately accessing the database through Class::DBI calls
to ensure that the web changes are reflected correctly.
Then I use these with Devel::Cover, and I can see if my web-based
use-cases are actually touching the amount of code I had hoped.
CGIP with CGIP-Mecha. Great combo.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me...@st...> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
|