On Mar 1, 2009, at 05:44 , nlloyds wrote:
>
> I've created a branch (http://github.com/smith/jsunittest/tree/multi)
> of jsunittest that can work on Rhino, SpiderMonkey, WScript, ASP, and
> possibly others.
That's really cool.
> It works by setting JsUnitTest.Unit.Runner.loggerType to the name of a
> Logger or passing in a loggerType option to the Test.Unit.Runner
> constructor. That option is used to create the right logger (DOMLogger
> by default, there's also a CLILogger in the branch, and I'm making an
> HTMLLogger to output the test HTML as a string.)
So, isn't it possible to use more than one logger? Maybe a publisher/
subscriber pattern would work best.
> The tests won't automatically run, so there's an output() method. If
> window and setTimeout are present it will do what it does now (run
> runTests() on window.onload), otherwise it will just call runTests().
> So you can do:
>
> var suite = new Test.Unit.Runner(...);
> suite.output();
>
> or just:
>
> new Test.Unit.Runner(...).output();
>
> output() will return the return value of runTests().
Then, if I understand correctly, tests are run automatically but the
logger is silent until output is called?
I'd like to suggest a different approach:
var myLogger = new MyCustomLogger();
new Test.Unit.Runner(tests_list_object, { loggers: myLogger });
(Where the loggers configuration property would be a logger or an
array of loggers.)
This would allow both using multiple loggers and let them decide about
output.
So, for the previous case, you would use
myLogger.output();
What do you think?
--
Choan
<http://choangalvez.nom.es/>