On Jul 29, 2004, at 20:42, Alexey Verkhovsky wrote:

> On Fri, 2004-07-30 at 03:12, Nathaniel Talbott wrote:
>> one possible alternative to subclassing
>> would be to just create a delegating wrapper around the runner (since
>> you want to run normally PLUS outputting XML).
>
> If I understand you right, you mean some sort of decorator like this:
>
> Test::Unit::TestReporter.new(:XML, 'build/reports', AllTests.suite)
>
> Correct?

I was thinking more like (untested):

   class RunnerWrapper < SimpleDelegate
     def initialize(runner, output_dir, format = :xml)
       super(runner)

       add_listeners(runner.instance_eval{@mediator})
     end

     def add_listeners(mediator)
       # Collect the information you're interested in

       # When you receive the TestRunnerMediator::FINISHED event,
       # write out the report
     end
   end

Does that help?


Nathaniel
Terralien, Inc.

<:((><