views:

351

answers:

3

Does anyone know of a good Perl unit test generator?

+2  A: 

EDIT: (Thanks to commentors)

My original suggestion of PerlUnit is deprecated. Use Test::Class instead.

Original Post:

You could try PerlUnit. There is also a book chapter on unit testing in Perl: Extreme Perl: Chapter 13: Unit Testing

Colin
Use Test::Class if you want nUnit style testing.
jrockway
PerlUnit was abandoned years ago and does not play well with Perl's standard testing tools. Test::Class is a better choice for this.
Ovid
+10  A: 

Not sure what you're asking, but most people write tests with Test::More or Test::Class. You then run these tests with the prove command included with Perl (actually, with Test::Harness).

Example test:

# foo.t
use strict;
use warnings;
use Test::More tests => 1;

ok( 1 == 1, 'is one one?' );

Running this:

$ prove foo.t

foo....ok
All tests successful.
Files=1, Tests=1,  0 wallclock secs ( 0.01 usr  0.01 sys +  0.03 cusr  0.00 csys =  0.05 CPU)
Result: PASS
jrockway
A: 

If you're going to test web apps, Selenium IDE allows you to do stuff in firefox and have it automatically be recorded as an equivalent set of Perl (or other language) tests.

While it doesn't test everything, it is good for testing the user experience.

ysth
The OP didn't say anything about web testing, so you can't assume that Selenium would be of any help.
mpeters
The OP didn't really say much to indicate what s/he was talking about at all. And certainly somebody may find this answer just what they were looking for someday. The "For web apps," at the beginning should clue in those not interested; that's why I started with it.
ysth
Although he was indeed pretty cryptic, he did at least say that he wanted Unit tests. Selenium may be a cool framework, but it's give you integration tests.
innaM
Thanks for the comments. The basic Idea of the question was to explore options of unit test generators for perl. I found j_random_hackers comment to my question as an answer. I also think my question was not cryptic but was not limiting the scope. In that sense the answer of Selenium IDE is legible [to my abstract question] .
Neer