On Fri, Jul 29, 2005 at 02:49:07PM -0700, chromatic wrote:
> Only a little?  I might have to apply the cluestick with some force.
> 
> > So is there a plan (he asks curiously)?
> 
> I would really like to see objects representing different types of
> tests, so that you can decorate the test classes with roles to display
> their output the way you want it when you iterate over the results.

This is, IMHO, the wrong place to do it.  The test should not be responsible
for decorating results, Test::Harness should be.  It means you can decorate 
ANY test, not just those that happen to use Test::Builder.  It neatly avoids
the problem of hoping that the test author happened to code the way you
need.  JUnit's model, where the test runner and the test are together in
the same process, has this problem.  You can't separate the runner from the
tests.  If the author didn't think to display it how you like you're screwed.

That said, the idea is to reduce Test::Harness::runtests() to this.

        my $strap = Test::Harness::Straps->new;
        $strap->decorator(Test::Harness::Decorator::Default->new);
        $strap->analyze_file($_) for @ARGV;

You have a parser (Straps) and you hand it a decorator (which is currently all
the Test::Harness code outside of Straps).  The parser runs the tests and as
it sees each event it informs the decorator which can do whatever it wants.
Print it to the screen.  Send an email.  Output HTML or XML.  Release the
hounds... whatever.  You want a different format you write your own
decorator.

That's been the plan since Straps came into being.  The major stumbling block
has been the total lack of tests for Test::Harness' output.  That and the
existing decoration code is pretty heinous in places.


-- 
Michael G Schwern     [EMAIL PROTECTED]     http://www.pobox.com/~schwern
I do have a cause though. It's obscenity. I'm for it.
    - Tom Lehrer

Reply via email to