[Israel.pm] Using perl as unit-testing framework

Gabor Szabo szabgab at gmail.com
Tue Nov 24 00:36:51 PST 2009


On Mon, Nov 23, 2009 at 10:49 AM, Gaal Yahas <gaal at forum2.org> wrote:
>
>> Important features are:
>> 1. minimum end-user requirements (preferably - will not require them to install modules with CPAN)
>
> Remain open to reconsidering this point. CPAN has a great deal of
> useful test modules (though most of them are aimed at helping in
> writing unittests). You can of course start without them, but at least
> take a look at what's around so you can decide to refactor later.

In the end you will have to make sure the users have a
1) recent version of perl
2) your code

IMHO instead of restricting yourself to core perl you should consider how
to make sure you can package your code along with any necessary dependencies
or teach the users how to install those.


>
>> 2. Set command line arguments and STDIN, check STDOUT, STDERR and exitcode (and of course segfaults and signals).
>
> IPC::Run3 as I mentioned; though now that I think of it it would be
> useful to have a Test::Invoke module that wrapped this.

Some time ago I wrote a module called Test::Snapshots
http://search.cpan.org/dist/Test-Snapshots/
that provides a framework to run a bunch of executables providing
STDIN, arguments and checking
STDOUT, SDTERR and the exit code to a set of expected values.

Let me know if that can be useful to you.

Gabor
http://twitter.com/szabgab
http://szabgab.com/blog.html


More information about the Perl mailing list