One Distribution to rule them all, One Distribution to find them, One Distribution to bring them all and under testing bind them
because DBI and SQL::Statement will rely on DBI::Test, every module based on either of them can and should use it, too
the team of DBI authors and maintainers currently strongly cooperates to fix found issues in either DBI or a DBD with the DBI Driver authors, which are often the same people
like Test::Database by Philippe Bruhat DBI::Test helps tests to find suitable datasources
team persist of Peter Rabbitson (ribasushi), H. Merijn Brandt (Tux) and Jens Rehsack (Sno) convinced some DBD maintainers to use it and will continue convince everyone
Mentor Tim Bunce watches the activities and helps to make and keep our customers happy
continuous cooperation will be improved by relying on the same test cases
What's to do by any DBD maintainer or author to benefit from DBI::Test
use lib 'lib'; # for use DBI::DBD
use DBI::Test::Conf ();
my @gen_tests = DBI::Test::Conf->setup(
AUTHOR_TESTS => 0,
SKIP_FILE => "DBI-TEST.SKIP",
CONTAINED_DBDS => [qw'DBM File']);
MANIFEST.SKIP
Makefile.PL
/ Build.PL
WriteMakeFile( ...
test => { TESTS => join(' ' =>
't/*.t xt/*.t', # non-populated
@gen_tests), }, # populated
clean => { FILES => join(' ' =>
@gen_tests ), });
From there on, all DBI::Test and DBI::Test's plugins (as DBI and SQL::Statement provided tests are populated and will be run on make test
Create a dbi-test.json
{ "DBI::Test::basic::connect":
["dbi::CSV:",null,null,
{"csv_class":"Text::CSV_XS"}], "DBI::Test::basic::disconnect":
["dbi::CSV:",null,null,
{"csv_class":"Text::CSV_XS"}]
}
Create a DSN Provider
package D::T::DBI::DSN::Provider::DBM;
use base "D::T::DSN::Provider::Dir";
# deliver DSN's generic configuration
# for test population
sub dsn_conf { ... }
# deliver DSN for using in run_test
sub get_dsn_creds { ... }
package D::T::C::SQL::Statement::error;
use parent qw(D::T::SQL::Statement::C);
use Data::Dumper;
use Test::More;
use DBI::Test;
# return true when $cfgs are supported
sub supported_variant {
my ($me, $tc, $cfg_pfx, $cfgs,
$dsn_pfx, $dsn, $options) = @_;
... }
# deliver DSN for using in run_test
sub run_test {
my @DB_CREDS = @{$_[1]};
... }
package D::T::SQL::Statement::List;
use strict;
use warnings;
use parent qw(DBI::Test::List);
sub test_cases
{
my $bas = "SQL::Statement::";
map { $bas . $_ } qw(error);
}
want to know more?
use the source, Luke!
This presentation has been created by Jens Rehsack with impress.js and VI Improved.
I'm a freelancer in cologne area.
Questions? rehsack@cpan.org or (more responsive) dbi-dev@perl.org