.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "DBI::Test 3pm" .TH DBI::Test 3pm "2021-01-04" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" DBI::Test \- Test suite for DBI API .SH "SYNOPSIS" .IX Header "SYNOPSIS" In Makefile.PL: .PP .Vb 9 \& use lib \*(Aqlib\*(Aq; # to allow DBI::Test finds the test cases of your driver \& use DBI::Test::Conf (); \& my @generated_tests = DBI::Test::Conf\->setup(); \& WriteMakefile ( \& test => { \& TESTS => join (\*(Aq \*(Aq => \*(Aqxt/*.t\*(Aq, @generated_tests), \& }, \& clean => { FILES => join( " " => @generated_tests ) } \& ); .Ve .PP You provide .PP .Vb 1 \& package DBI::Test::Your::Namespace::List; \& \& sub test_cases \& { \& return qw(...); # list of the test cases you provide \& } \& \& package DBI::Test::Your::Namespace::Conf; \& \& sub conf \& { \& my %conf = ( \& gofer => { \& category => "Gofer", \& cat_abbrev => "g", \& abbrev => "b", \& init_stub => qq(\e$ENV{DBI_AUTOPROXY} = \*(Aqdbi:Gofer:transport=null;policy=pedantic\*(Aq;), \& match => sub { \& my ($self, $test_case, $namespace, $category, $variant) = @_; \& ... \& }, \& name => "Gofer Transport", \& }, \& ); \& } \& \& package DBI::Test::Your::Namespace::Case::Your::First; \& \& ... # will be t/your/namespace/your/first.t \& \& package DBI::Test::Your::Namespace::Case::Your::Second; \& \& ... # will be t/your/namespace/your/second.t \& \& 1; .Ve .PP And enhance DBI::Test with own test cases. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module aims to be a test suite for the \s-1DBI API\s0 and an underlying \s-1DBD\s0 driver, to check if the provided functionality is working and complete. .PP Part of this module is the ability for self-testing using \fIDBI::Mock\fR. This is not designed to be another \fIDBI::PurePerl\fR \- it's designed to allow tests can be verified to work as expected in a sandbox. This is, of course, limited to \s-1DBI API\s0 itself and cannot load any driver nor really execute any action. .SH "EXPORTS" .IX Header "EXPORTS" .SS "connect_ok" .IX Subsection "connect_ok" .Vb 1 \& $dbh = connect_ok($dsn, $user, $pass, \e%attrs, $test_name); .Ve .PP connect_ok invokes \s-1DBI\-\s0> and proves the result in an \fIok\fR. The created database handle (\f(CW$dbh\fR) is returned, if any. .SS "connect_not_ok" .IX Subsection "connect_not_ok" .Vb 1 \& $dbh = connect_not_ok($dsn, $user, $pass, \e%attrs, $test_name); .Ve .PP connect_not_ok invokes \s-1DBI\-\s0> and proves the result in an \fIok\fR (but expects that there is no \f(CW$dsn\fR returned). The created database handle (\f(CW$dbh\fR) is returned, if any. .SS "prepare_ok" .IX Subsection "prepare_ok" .Vb 1 \& $sth = prepare_ok($dbh, $stmt, \e%attrs, $test_name); .Ve .PP prepare_ok invokes \f(CW$dbh\fR\->prepare and proves the result in an \fIok\fR. The resulting statement handle (\f(CW$sth\fR) is returned, if any. .SS "execute_ok" .IX Subsection "execute_ok" .Vb 2 \& $rv = execute_ok($sth, $test_name); \& $rv = execute_ok($sth, @bind_values, $test_name); .Ve .PP execute_ok invokes \f(CW$sth\fR\->excute and proves the result via \fIok\fR. The value got from \f(CW$sth\fR\->execute is returned. .SS "execute_not_ok" .IX Subsection "execute_not_ok" .Vb 2 \& $rv = execute_not_ok($sth, $test_name); \& $rv = execute_not_ok($sth, @bind_values, $test_name); .Ve .PP execute_not_ok invokes \f(CW$sth\fR\->excute and proves the result via \fIis(undef)\fR. The value got from \f(CW$sth\fR\->execute is returned. .SS "do_ok" .IX Subsection "do_ok" .Vb 2 \& $rv = do_ok($dbh, $test_name); \& $rv = do_ok($dbh, @bind_values, $test_name); .Ve .PP do_ok invokes \f(CW$dbh\fR\->do and proves the result via \fIok\fR. The value got from \f(CW$dbh\fR\->do / \f(CW$sth\fR\->execute is returned. .SS "do_not_ok" .IX Subsection "do_not_ok" .Vb 2 \& $rv = do_not_ok($dbh, $test_name); \& $rv = do_not_ok($dbh, @bind_values, $test_name); .Ve .PP do_not_ok invokes \f(CW$dbh\fR\->do and proves the result via \fIis(undef)\fR. The value got from \f(CW$dbh\fR\->do / \f(CW$sth\fR\->execute is returned. .SH "GOAL" .IX Header "GOAL" .SS "\s-1TODO\s0" .IX Subsection "TODO" .SS "Source" .IX Subsection "Source" Recent changes can be (re)viewed in the public \s-1GIT\s0 repository at GitHub Feel free to clone your own copy: .PP .Vb 1 \& $ git clone https://github.com/perl5\-dbi/DBI\-Test.git DBI\-Test .Ve .SS "Contact" .IX Subsection "Contact" We are discussing issues on the \s-1DBI\s0 development mailing list 1) and on \s-1IRC 2\s0) .PP .Vb 2 \& 1) The DBI team \& 2) irc.perl.org/6667 #dbi .Ve .SH "SUPPORT" .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc SQL::Statement .Ve .PP You can also look for information at: .IP "\(bu" 4 \&\s-1RT: CPAN\s0's request tracker .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Search .Sp .SS "Reporting bugs" .IX Subsection "Reporting bugs" If you think you've found a bug then please read \&\*(L"How to Report Bugs Effectively\*(R" by Simon Tatham: . .PP Your problem is most likely related to the specific \s-1DBD\s0 driver module you're using. If that's the case then click on the 'Bugs' link on the page for your driver. Only submit a bug report against the DBI::Test itself if you're sure that your issue isn't related to the driver you're using. .SH "TEST SUITE" .IX Header "TEST SUITE" DBI::Test comes with some basic tests to test itself and DBI::Mock. The same tests are used for basic \s-1DBI\s0 self-tests as well as testing the SQL::Statement mock driver. .SH "EXAMPLES" .IX Header "EXAMPLES" ??? Synopsis ??? .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" ??? .SH "SEE ALSO" .IX Header "SEE ALSO" .Vb 3 \& DBI \- Database independent interface for Perl \& DBI::DBD \- Perl DBI Database Driver Writer\*(Aqs Guide \& Test::More \- yet another framework for writing test scripts .Ve .SH "AUTHOR" .IX Header "AUTHOR" This module is a team-effort. The current team members are .PP .Vb 4 \& H.Merijn Brand (Tux) \& Jens Rehsack (Sno) \& Peter Rabbitson (ribasushi) \& Joakim TE<0x00f8>rmoen (trmjoa) .Ve .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C)2013 \- The \s-1DBI\s0 development team .PP You may distribute this module under the terms of either the \s-1GNU\s0 General Public License or the Artistic License, as specified in the Perl \s-1README\s0 file.