Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest
In directory usw-pr-cvs1:/tmp/cvs-serv32316/lib/HTTP/WebTest
Modified Files:
Cookbook.pod
Log Message:
Extended 'User-Defined Tests' example
Index: Cookbook.pod
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Cookbook.pod,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Cookbook.pod 21 Jun 2002 10:51:54 -0000 1.15
--- Cookbook.pod 22 Aug 2002 08:36:50 -0000 1.16
***************
*** 151,157 ****
# load HTTP::WebTest::Plugin::Hooks module which provides test
! # parameter 'on_response'
plugins = ( ::Hooks )
....
--- 151,168 ----
# load HTTP::WebTest::Plugin::Hooks module which provides test
! # parameters 'on_start', 'on_finish' and 'on_response'
plugins = ( ::Hooks )
+ on_start = {
+ # initialize a database handle used later in the tests
+ require DBI;
+ $dbh = DBI->connect('dbi:mysql:test', 'login', 'password');
+ }
+
+ on_finish = {
+ # disconnect from the database
+ $dbh->disconnect;
+ }
+
....
***************
*** 163,168 ****
# define check
on_response = {
! # it is assumed that $Test::dbh is database handler
! my $has_record = $Test::dbh->selectrow_array(
'SELECT COUNT(*) FROM USERS ' .
'WHERE NAME = ?',
--- 174,178 ----
# define check
on_response = {
! my $has_record = $dbh->selectrow_array(
'SELECT COUNT(*) FROM USERS ' .
'WHERE NAME = ?',
|