FireUnit extension for YUI Test
I love unit testing, especially for JavaScript, which is why I wrote YUI Test. John Resig just announced another exciting tool for unit testing called FireUnit. FireUnit is an extension to Firebug (1.2+) and adds another tab to the Firebug console in which test results are output. Also included is a small JavaScript API for outputting results onto the Test tab.
When I wrote YUI Test, I made sure that the TestRunner object was completely event-driven so that test results could be output in any way that made sense. To prove how easy it is to create your own visualization for YUI Test results, I created a FireUnit extension for YUI Test. The extension is nothing exciting, just a simple JavaScript object that subscribes to the various TestRunner events and then marshals them to the appropriate FireUnit API calls. All you need to do is load the file and include the following line of code:
YAHOO.tool.FireUnit.attach();
That’s it! All the results will be output to the Test tab in Firebug. There are some limitations to FireUnit, such as its inability to group tests and a lack of anything but basic result formatting (so some of the failure messages YUI Test generates don’t look all that pretty). Still, it’s a step in the right direction and I’m sure John will be continuing to develop it. Feel free to download FireUnit for YUI Test and give it a whirl (BSD license).
Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of Yahoo!, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.
You can leave a response, or trackback from your own site.
2 Comments
[...] FireUnit extension for YUI Test [...]
Writing Effective JavaScript Unit Tests with YUI Test » Yahoo! User Interface Blog on January 5th, 2009 at 2:39 pm
[...] FireUnit Extension for YUI Test: YUI Test author Nicholas C. Zakas has released an experimental hookup between YUI Test and the new FireUnit Firebug extension on his personal blog: “When I wrote YUI Test, I made sure that the TestRunner object was completely event-driven so that test results could be output in any way that made sense. To prove how easy it is to create your own visualization for YUI Test results, I created a FireUnit extension for YUI Test. The extension is nothing exciting, just a simple JavaScript object that subscribes to the various TestRunner events and then marshals them to the appropriate FireUnit API calls. All you need to do is load the file and include the following line of code: YAHOO.tool.FireUnit.attach();. That’s it! All the results will be output to the Test tab in Firebug. (Original source.) [...]
In the Wild for January 6, 2009 » Yahoo! User Interface Blog on January 6th, 2009 at 5:10 pm
Leave a Comment