![]() |
|
Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Strategy for conditional logging in testsby andreas1234567 (Vicar) |
on Apr 01, 2008 at 11:52 UTC ( #677740=perlquestion: print w/replies, xml ) | Need Help?? |
andreas1234567 has asked for the
wisdom of the Perl Monks concerning the following question:
I use Log::Log4perl for logging, and
Test::More and Test::Exception for testing. I write a
number of negative tests (e.g. to see if a module reacts correctly
when given incorrect input), and the output from these tests can be
very verbose. This means the unexpected error messages (if any) will be far outnumbered by the expected ones, thus harder to detect when reading the output.
I'm looking for a strategy on how to suppress output from negative tests (warnings, output from die etc.), while keeping the output enabled for the positive tests (where output is unexpected and might indicate a problem). The dilemma is probably best shown with an example: foo.pl foo.t Run The above code takes an all-or-nothing approach to the logging, which results in the wanted possible overflow warning to be suppressed. Do any of the Enlightened Monks have thoughts on how to selectively suppress output from tests?
-- Andreas
Back to
Seekers of Perl Wisdom
|
|