Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pdcawley (485)

  (email not shown publicly)
AOL IM: pdcawley (Add Buddy, Send Message)

Journal of pdcawley (485)

Friday July 05, 2002
06:47 AM


[ #6189 ]

So, you may or may not know that I've been working on and off on PerlUnit (aka Test::Unit::TestCase), a Perl port of Kent Beck's xUnit.

Now, as these things go, PerlUnit is pretty good, it's a fairly straight port of jUnit, which is a java version of the Smalltalk original, sUnit.

The problem is that it's not really very perlish. You can run PerlUnit tests in such a way that Test::Harness can use the results, but it can be awkward.

Then, along comes Test::Class and it's lovely. Adrian Howard has done a fantastic job of taking the basic ideas behind xUnit and the simple interface of Test::More/Simple that we're used to, and producing a really useful synthesis of the two.

He doesn't try and do as much as PerlUnit, and there are a few surprises if you're used to the xUnit approach where a failing assertion (which is about the granularity of C in Test::More) bails out of the current test method. PerlUnit counts test methods, Test::Class counts (and requires you to, but makes it easy) the tests done within methods. The list continues.

And then, top cap it all, Test::Class is tiny PerlUnit is, frankly, enormous. I'm sure there are times when I'll find myself hankering for some deep feature of PerlUnit, but for now, I'm switching to Test::Class.

Oh yes, and Test::Class plays well with Test::MockObject, which is another top notch testing tool.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I've been meaning to ask for a while now - what's the difference between PerlUnit and Is it just a matter of how the tests are written, or is there something fundamentally better about PerlUnit?
    • PerlUnit is a port of Kent Beck's JUnit to Perl. JUnit and the like are very much tied to a strongly-OO approach of doing things. (I believe it grew out of Smalltalk.) They set up test harnesses with classes and all sorts of things that aren't necessarily Perlish, but really fit the Java model. is a somewhat-old Perl module. I think Larry originally wrote it. Test::More is an expanded and enhanced version of that with more features, more tests, better diagnostics, and a really spectacular back

      • IME, PerlUnit requires more work and planning for a task that most people never do and have little experience in. Test::More is so simple that there's no excuse not to write tests.

        BTW: nice article on Test::MockObject!