Test::Class fixture problem



I've just spent quite a bit of time debugging a problem where a Test::Class setup method was misbehaving. My tests passed, but mysql was spitting out errors directly to STDERR and quite a bit of tracing led me to the following:

sub setup : Tests(setup) {
my $test = shift;
$test->SUPER::startup;
$test->_make_test_servers(
num_servers => 2,
username => 'Ovid',
);
}

As you can see, I called SUPER::startup instead of SUPER::setup.

My base class has stubs for these methods to ensure that I never have a problem with SUPER::

sub startup : Tests(startup) {}
sub setup : Tests(setup) {}

sub teardown : Tests(teardown) {}

sub shutdown : Tests(shutdown) {}


Sometimes in my hierarchy, though, the SUPER::startup (or whatever) method will call a chain of two of these before getting to the stub. It's trivial to write code in my stubs which check the caller and issue a warning and maybe I can just walk back through the call stack to issue a warning if I'm ever called by an inappropriately named method, but that seems a bit hackish. Is there some better way to solve this problem?

Cheers,
Ovid


--
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/



.



Relevant Pages

  • Re: Loading a form
    ... Load the main form and call that procedure immediately after showing the splash screen. ... This is easier if you're using Sub Main as your startup object because you'd do all of this from there. ... Private Declare Sub Sleep Lib "kernel32" ... Public Function Setup() As Boolean ...
    (microsoft.public.vb.general.discussion)
  • Advice and opinion on new system setup
    ... 74oz to an amp. ... I was thinking of letting the head unit power the two fronts, and setup ... a tri-way to the rears and the sub, but I got to thinking, since one 2 ... One to power the 4 speakers and one to power the sub. ...
    (rec.audio.car)
  • Re: Installation eines Dienstes .NET 1.1
    ... Public Sub Main() ... Wenn ich das Setup auf dem Zielrechner ausführe, ... Auf dem Zielrechner ist .NET 1.1 und 2.0 installiert. ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: Anyone got a docking thing for an iPod?
    ... I think you will still need some conventional woofers even if you are ... using the sub. ... through my bi-amp setup. ... I'm using a dbx active crossover to do the split. ...
    (rec.boats)
  • Re: Anyone got a docking thing for an iPod?
    ... I think you will still need some conventional woofers even if you are ... using the sub. ... through my bi-amp setup. ... I'm using a dbx active crossover to do the split. ...
    (rec.boats)