Michael G Schwern wrote:

On Tue, Mar 08, 2005 at 03:39:17PM -0500, Michael Graham wrote:


Something that's been sitting in the Test::Builder repository for a while
now is Test::Builder->create. Finally you can create a second Test::Builder
instance. I haven't done much with it and I think $Level is still global
across all instances (bug) but I figured folks would want to play with it
particuarly the Test::Builder::Tester guys.


Would this make it possible to run many test scripts (each with its own
plan) within the same perl process? 'Cos that would be nifty.



Yes. Though beyond testing testing libraries I don't know why you'd want to
do that.


The use case I've been pondering is to be able to better control the granularity of my tests within a particular scripts. Stuff like Test::Class and Test::Block gets closer but not quite to what I would like. I'd like to be able to define a "block" of tests and either report that the whole block succeeded or else show me that it failed with a diagnostic about the individual tests within it. In effect, I'd like to be able to localize "verbosity". I'm in the middle of cobbling up a module to do it -- the approach I have in mind is storing the blocks as a code reference, running the first block (in an eval to trap dies), storing away a copy of the Test::Builder results, resetting Test::Builder, running the next, etc., etc., then at the end resetting Test::Builder one final time and passing/failing for each result set (with diagnostics that show the verbose results of the individual tests passing or failing.) Since I'm trying test-first development, I'm currently hung up in the middle of figuring out how to test that it's doing the what I want before I write it. I think the approach works, but all this mucking about in the internals of Test::Builder feels like voodoo.

Regards,
David


Reply via email to