#!/usr/bin/perl -w use strict; use Test::More qw(no_plan); use Data::Dumper; use Log::Log4perl qw(:levels); use HPA::LT_Utils::File; # the module under test Log::Log4perl->init_and_watch('generic_log.conf', 10); my $logger = get_logger('File'); my $file = HPA::LT_Utils::File->new(undef); is(scalar @{$file->[HPA::LT_Utils::File::_CP]}, 0) or $logger->debug(D +umper($file)); # check internal state is($file->output, '') or $logger->debug('the output() method seems to +have been borked - ', Dumper($file)); # check interface correctness ...
that example is effectively the same as just prints, the power is in log statements between test cases, when you sometimes want to see the state before some other group of ests run
# test requirement X is(....); is(....); is(....); $logger->debug('X OK, now test Y ', Dumper($obj)); # test requirement Y is(....); is(....); is(....);
The advantage is that you aren't constantly adding and deleting print statements - once the log statements are there, you enable/disable them as required.
use brain;
In reply to Re: Using Data::Dumper in Test-Driven Development
by leriksen
in thread Using Data::Dumper in Test-Driven Development
by dws
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |