[Catalyst] App testing with Test::WWW::Mechanize::Catalyst

ivorw m9tn-oh4c at xemaps.com
Thu Jul 31 18:11:34 BST 2008

Marius Kjeldahl wrote:
> my $APPLOC = 'http://localhost/calapp/no';
> $u->get_ok ($APPLOC, 'Application startup');
> fails with:
> Couldn't instantiate component "CalApp::Model::CalAppDB", "Either
> ->config->{connect_info} must be defined for CalApp::Model::CalAppDB
> or CalAppDB must have connect info defined on itHere's what we got:
> $VAR1 = bless( {
>                  'schema_class' => 'CalAppDB',
>                  'connect_info' => undef
>                }, 'CalApp::Model::CalAppDB' );
>  at /usr/local/share/perl/5.8.8/Catalyst/Test.pm line 90" at
> /usr/local/share/perl/5.8.8/Catalyst/Test.pm line 90
I've seen this or similar. It's usually an indication that the Catalyst
code is failing to see the config file (calappdb.yml or calappdb.conf),
when you are defining the DBI parameters here rather than hardcoding
them inside CalApp::Model::CalAppDB.pm which the helper script does for
you by default.

Maybe you're running your tests from a different directory than where
the config file lives. Try running your test with CALAPP_CONFIG=/path/to/dir

I actually have a special config I use for running tests (though the
default tests that get created are completely safe to run against the
live database). My tests are destructive, and start by creating a brand
new SQLite database that I can run against.

More information about the Catalyst mailing list