Subject: | Abort tests quickly if connect fails |
Date: | Sat, 22 Dec 2007 01:23:09 -0500 |
To: | bug-DBD-mysql [...] rt.cpan.org |
From: | Michael Leahy <michael.leahy1 [...] comcast.net> |
The file t/10connect.t has a test to determine if we can connect to the
server. If this test fails, most of the remaining tests in the test suite
will fail, won't they?
Would it make sense to abort the tests immediately using
Test::More::BAIL_OUT() if the connection cannot be established (in the case
of incorrect password, for instance)?
my $dbh= DBI->connect($test_dsn, $test_user, $test_password,
{ RaiseError => 0, PrintError => 1, AutoCommit => 0 });
if (!defined $dbh)
{
BAIL_OUT( "Connect to database failed, aborting remaining tests." );
}
ok(defined $dbh, "Connected to database");
ok($dbh->disconnect());
Thanks,
--Michael