Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perl aids for regression testing

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

Also, in case there are differences but the output is OK (because the functionality has changed) I want to be able to commit the actual output as future reference output.

like image 204
Bart Avatar asked Sep 15 '08 19:09

Bart


People also ask

Which test is used for regression?

Quick Test Professional (QTP) QTP is an automated testing tool used for Regression and Functional Testing. It is a Data-Driven, keyword-based tool.


2 Answers

Perl has excellent utilities for doing testing. The most commonly used module is probably Test::More, which provides all the infrastructure you're likely to need for writing regression tests. The prove utility provides an easy interface for running test suites and summarizing the results. The Test::Differences module (which can be used with Test::More) might be useful to you as well. It formats differences as side-by-side comparisons. As for committing the actual output as the new reference material, that will depend on how your code under test provides output and how you capture it. It should be easy if you write to files and then compare them. If that's the case you might want to use the Text::Diff module within your test suite.

like image 178
Michael Carman Avatar answered Sep 22 '22 23:09

Michael Carman


As mentioned, Test::Differences is one of the standard ways of accomplishing this, but I needed to mention PerlUnit: please do not use this. It's "abandonware" and does not integrate with standard Perl testing tools. Thus, for all new test modules coming out, you would have to port their functionality if you wanted to use them. (If someone has picked up the maintenance of this abandoned module, drop me a line. I need to talk to them as I maintain core testing tools I'd like to help integrate with PerlUnit).

Disclaimer: while Id didn't write it, I currently maintain Test::Differences, so I might be biased.

like image 44
Ovid Avatar answered Sep 20 '22 23:09

Ovid