From: Alexey Verkhovsky Date: 2004-07-31T07:56:19+09:00 Subject: Re: Parameterized tests with test/unit On Fri, 2004-07-30 at 03:55, Nathaniel Talbott wrote: > 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 Alas, this doesn't work because runner.@mediator is instantiated in runner.start, not in the constructor. So far I haven't found any way of safely getting mediator instance from the runner. To move forward, I have added the following line in the TestRunner#start: Index: testrunner.rb =================================================================== RCS file: /src/ruby/lib/test/unit/ui/console/testrunner.rb,v retrieving revision 1.7 diff -c -r1.7 testrunner.rb *** testrunner.rb 21 Apr 2004 06:56:48 -0000 1.7 --- testrunner.rb 30 Jul 2004 22:48:30 -0000 *************** *** 38,43 **** --- 38,44 ---- def start setup_mediator attach_to_mediator + yield @mediator if block_given? return start_mediator end Not sure, if this is the right approach, but it is quite obvious to me that test runners need to be somehow refactored in order to support the kind of decoration we are talking about. By the way, I fully agree with this comment: # Perhaps there ought to be a TestRunner superclass? There # seems to be a decent amount of shared code between test # runners. Please decide and tell me how it will be. Meantime, I go ahead with the results formatter. Best regards, Alex