|P is for Practical|
Re: Unit Testing in Perlby dws (Chancellor)
|on Jun 25, 2005 at 16:20 UTC||Need Help??|
Is there any real consensus in the Perl community with respect to how unit testing ought to be done?
"Ought to be done" conflates two separate ideas: The first is the approach one takes to unit testing (e.g., TDD with or without mock objects, test-specific subclasses, etc.). Since the choice of approach is best dictated by the thing you're trying to build, and we're all building different things (albeit with some common themes), consensus here on a single approach is unlikely.
The second idea is about the specific testing tool or framework. A lot of unit testing in the non-Perl world uses some variant of xUnit, though the use of the tool may be less interesting than the choice of whether to mock, subclass, or whatever.
Which module, were I to use it, would cause the least scoffing from those in the know when it comes to unit testing Perl code?
I think you'll find that the scaffolding depends more on what you're trying to test than it does on your choice of testing framework. Test::More is a decent starting point. At work we use a custom subclass of Test which we're reasonably happy with. (And we have >12,000 unit tests.)
The fact that there is no well accepted standard is quite discouraging. Said lack makes it very difficult to do integration testing across modules, unless you could at least get everyone to agree to a common harness.
You're apparently seeing a problem here that I'm not. What do you mean by "integration across modules", and how does that vision depend on having a single test harness?