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.

3 Comments »

  1. Great work!
    I’m putting this into service pronto!

    Comment by Jeff — June 30, 2006 @ 2:53 pm

  2. I would like to do something similar to that, but I don’t want to have to change MbUnit’s source. Is there any way to set the XML reports to use a custom stylesheet?

    I don’t mind opening the XML file instead of generating an HTML one, as long as it uses my stylesheet (and I also don’t have to change the file manually to use it).

    Do you know how I can achieve this?

    Comment by Andre — November 22, 2006 @ 7:05 am

  3. See my reply in the MbUnitUser group:
    http://groups.google.com/group/MbUnitUser/tree/browse_frm/thread/b33b5795c5000063/6dcd556690b3dec5?rnum=1&_done=%2Fgroup%2FMbUnitUser%2Fbrowse_frm%2Fthread%2Fb33b5795c5000063%2F6dcd556690b3dec5%3F#doc_2ac9feccdb5ceb67

    Comment by marcstober — November 22, 2006 @ 11:04 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

Copyright © 2006-2008 Marc Stober

Powered by WordPress