Perl Regression Testing Tools

Is there a Perl module that allows me to view diffs between the actual and reference output of programs (or functions)? The test does not work if there are differences.

In addition, if there are differences, but the output is in order (since the functionality has been changed), I want to be able to capture the actual output as a future reference output.

+5
source share
6 answers

Perl has great testing tools. The most commonly used module is probably Test :: More, which provides the entire infrastructure that you will probably need to write regression tests. The evidence utility provides a simple interface for running test suites and summarizing. The Test :: Differences module (which can be used with Test :: More) may be useful to you. It formats differences as parallel comparisons. As for capturing the actual output as new reference material, it will depend on how your test code provides the output and how to capture it. This should be easy if you write files and then compare them. In this case, you can use the Text :: Diff module in your test suite.

+11

, Test:: Differences , PerlUnit: , . "" Perl. , , . ( - , . , , PerlUnit).

: Id , Test:: Differences, .

+6

Test:: Simple Test:: More. PerlUnit , , , Test:: Simple Test:: More.

+4

, PerlUnit. 3 . xUnit, Test::Class, , Perlish. , - , .

, . , Test::More - , ( ). " [] Test:: Class" .

+3

Test:: Command. stdout stderr ( ) . :.

   use Test::Command tests => 3;

   my $echo_test = Test::Command->new( cmd => 'echo out' );

   $echo_test->exit_is_num(0, 'exit normally');
   $echo_test->stdout_is_eq("out\n", 'echoes out');
   $echo_test->stderr_unlike( qr/something went (wrong|bad)/, 'nothing went bad' )

, .

+2

Test:: Simple ( ) Test:: More ( , Test:: Simple). , , . Perldoc .

Perl QA wiki, perl, perl-qa , , - Perl, .

Finally, using the starter module tool (from the :: Starter module) will give you a really nice “CPAN standard” for new work — or for deleting existing code in — including setting up your finished test harness.

+2
source

All Articles