|Perl: the Markov chain saw|
Wrapping Test::More assertions in Test::More utility classes?by silkybones (Initiate)
|on Sep 25, 2012 at 15:56 UTC||Need Help??|
silkybones has asked for the
wisdom of the Perl Monks concerning the following question:
Greetings Monks. Long time listener. First time caller.
Basically, I'm using Test::More to deal with Unit-testing a huge and unruly codebase, but I want to be able abstract out common Test::More assertion wrappers so I can re-use them.
I've looked at TAP::Harness, Test::Builder, and other modules. The only one that seems to get close to what I need is Test::Builder (which is not based on Test::More) because you can actually call new(), or create() on the class, and then set the number of tests, and tell the class when to run tests.
Basically, the client of the Test::More extension/wrapper class would do things like this:
The point of this is that I'd like my test classes to not have to use Test::More. I want my test classes to to able to share functions that wrap Test::More assertions, so I don't have to do things like this in each of my test classes:
Is there some way I can create such an object that wraps Test::More assertion methods and can dynamically set the number of thests, all without losing the Test::More runtime flow?