NAME

Test::Output - make it easier to do regression testing on logs or files

SYNOPSIS

my $diff = new Test::Output("../regret/mytest");

$diff->check("log.011");
$diff->check("log.012");

$diff->go();

DESCRIPTION

Runs a context diff on a set of files with the expectation that these files will not change.

#

Create a new Test::Output object $TEST. Pass the directory $DIR that you will use to save all the log files in question. STDOUT is redirected to $DIR/out.

#

Execute the code you want to test. Pass any files you want to check to the check('file') method.

#

When you are done with your code, call $TEST->go(). All the files you mentioned will be compared with files generated during the prior run. Context diffs will be sent to $DIR/diffs. File statuses will be written to standard output:

FILE STATUS:
ok /tmp/out
ok /tmp/risk0
ok /tmp/risk1
ok /tmp/risk3
ok /tmp/risk4
!! /tmp/risk2

ok indicates that there were no differences. You can examine the differences in the files marked with !! in the $DIR/diffs file.

If you decide to accept the new versions, you may source the $DIR/accept shell script. This script will copy the new versions into $DIR. These new files will be used for future comparisons.

The key to using this package successfully is to compare deltas instead the logs themselves. So you might create a before.log, after.log and then check the diff between them. Context diffing non-context diffs produces some interesting result files!

BUGS

There are no test scripts. (Ack!)

AUTHOR

Copyright (c) 1997 Joshua Nathaniel Pritikin. All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.