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

Boris Reitman boris.reitman at gmail.com
Sun Nov 22 22:48:07 PST 2009


I have rolled my own:

It is easy to write a C version of "is" and "ok" functions that print
"ok" or "not ok" in TAP format.  Then, each of your test is a C file
with a main() function where you go through some checks.  Get "make
check" to compile them, and then subcalass Test::Harness to loop over
executable files, not just files ending in ".t".  Then use your new
Test::Harness class to run all your tests and get a nice report.

2009/11/22 Assaf Gordon <gordon at cshl.edu>:
> Hello,
>
> I have a package of command line programs (written in c/c++) and I want to add unit-testing to it.
> It uses the gnu autotools, and I'd like users to be able to run "make check" to run the tests.
>
> I'm sure similar things have been done countless of times (probably using Perl).
> Do you have any recommendation on where to start ?
>
> Important features are:
> 1. minimum end-user requirements (preferably - will not require them to install modules with CPAN)
> 2. Set command line arguments and STDIN, check STDOUT, STDERR and exitcode (and of course segfaults and signals).
> 3. relatively easy to implement
>
> If the answer is RTFM, please point me to a good FM (for example, the main wiki for TAP has a lot of information, except starting examples for just two languages: C++ and PERL.... http://testanything.org/wiki/index.php/Testing_with_TAP )
>
>
> Thanks,
>  -gordon
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl
>


More information about the Perl mailing list