June 28, 2006

Improving MbUnit’s HTML report with JavaScript

Filed under: Software Blog — marcstober @ 10:23 am

Every morning in my email I get a couple unit test reports generated by MbUnit during our daily (actually nightly) build process. Many of our tests output a lot of logging information, so reading the report takes a lot of scrolling and there’s no way to see at a glance what’s failed.
I realized that MbUnit’s HTML reports are just an MbUnit XML report with an XSL transform. By downloading the MbUnit source code, I was able to get the XSL, modify it with some JavaScript, and do my own transform. Specifically, I added +/- buttons to expand and collapse the details of each test, and Expand All and Collapse All buttons at the top of the page. By collapsing the details, I get a nice summary of what’s passed and failed and I can then drill in to see just the errors I’m concerned about.

Before the change I can’t see more than a couple results without scrolling:mbunit-report-before.PNG

After I can collapse the the results and see them many at a glance:mbunit-report-after.PNG

Download the XSL file here.