in reply to Re: Getting timing details from a test
in thread Getting timing details from a test

I'm revisiting this year-old question because I had occasion last week to try to do this benchmark-plus-test thing in an extensible way and came up against some funny roadblocks. The most amusing/irritating was that overriding sub ok turned out to be a total bust! So I'll comment for posterity (which will include my future self) about why.

Quite simply, ok just reads the result of the test. So in ok(&test1, 'the first test') ; the ok method doesn't get invoked at all until test1 has finished. Hence, all my tests were showing up as instantaneous (because I was really just measuring time it took to call the ok method itself). What I need, somehow, is a version of "ok" that takes a subroutine as its first argument rather than a string then times the execution.

As part of the process, though, I came across Test::More::Diagnostic which seems like the right kind of idea for augmenting my outputs so that future executions can be compared to baseline. This seems like a version of "write your own harness," and I'm hoping it won't be all that difficult.