Re: [Perlunit-devel] Greetings
Status: Beta
Brought to you by:
mca1001
From: Matthias F. <mf...@hi...> - 2001-12-11 18:37:56
|
On Tue, 11 Dec 2001, Adam Spiers wrote: > > > It also occurred to me that a "nice-to-have" would be a verbose option > > > where it displays the name of each test and the TestCase class as it > > > progresses. > > > > Again, that's something to hang off the runner, and it definitely > > looks possible. > > Yep. Can you give us an example of the output you'd like to see? (Or > a patch ;-) Yeah, sure. I hadn't thought it through in detail but it shouldn't be hard to work up a simple patch. If I find time to do that, what should I do with it exactly? Send diffs? > sub test_case { > my $self = shift; > ... > $self->print('some debugging\n'); > ... > } > > and the debugging will only appear if the test case fails. This is > currently only supported by TestRunner.pm. Maybe we should think of > a better name than print(). This sounds pretty cool. What's the thinking behind making $self->print() output only show up when tests fail? I'm guessing that the idea is that you can print details of what's going on in the test so that when the test fails you have to do less digging to find the problem, but it doesn't clutter up the screen when the test succeeds. If that's correct I think it's great. I wrote some tests in JUnit the other day where I could have really used this feature: I had to do a bunch of messing around with StringBuffers to cram a whole lot of data into the failure message. How about $self->print_on_fail()? > > And Test::Unit::Web would be nice, and something to do mock objects, > > and... Hmm... I'm not sure what Test::Unit::Web is meant to be, but... it so happens that my first trial use of PerlUnit has been to do some stock web site testing. We host a few hundred web sites, the majority of which are functionally identical but the rest of which differ to varying degrees, so I took pains to make the code general and reusable. If that's what Test::Unit::Web would be about, my base class could possibly make a decent starting point. It tests that a page loads successfully within a customizable number of seconds, and provides some facilities for testing the contents of the page. More could easily be added. Anyone interested? Matthias |