I’ve been working with FitNesse for over a year now.  I’m on my second incarnation of fixtures, and now my second incarnation of a Hudson implementation.  Technically, it is the third, but I’ll get to that.  I thought I might share a little bit about this evolution and the final result.

Incarnation One

While I was getting started with my Fit based fixtures (incarnation one of my fixtures), one of the development leads I work with was working to make Hudson our CI tool.  He decided to help out and had a team member write a Hudson plug-in for it.  Unfortunately I wasn’t ready for this and so it sort of got abandoned.  When time came that I really needed to get FitNesse working under Hudson, I partly forgot about it and was partly hoping for an official plug-in that was mentioned on the FitNesse yahoo group.  So I sort of skipped it and went looking.

Incarnation Two

So with my goal to get FitNesse running under Hudson, I went searching and found two things that set me on the path.

  1. Showing FitNesse Test Results in Hudson
  2. A post by Gregor Gramlich which had an xslt for translating the XML result from test runner to HTML (sorry, can’t find the post any more)

This was great.  A few tweaks to the ant task from Andy Palmer, and I was up and running.  Well, there was some work in Gant to get our stuff running under Hudson due to some environment configuration stuff we need, but otherwise it was working.  I was getting ready to start moving this into use when…FitNesse updated with some changes I needed, and it broke.  It was a minor break, so I tweaked the ant script again to launch FitNesse via a jar, rather than the class.

Incarnation Three

So i was all set.  Things were working great and I was getting both HTML page results and JUnit style results in my local Hudson Instance.  It was great.  It worked just fine, until I ran a lot of tests.  I kept getting Java Heap errors when I ran my whole suite.  No problem when I ran a test or two, but run them all and boom.  I started investigating and I found the memory was blowing out in the same place every time.  It was always blowing up as new results streamed back from the server were appended to the string that was eventually going to be saved out.

I contacted Uncle Bob and he was having the same problem.  Due to the addition of Slim, the amount of data being sent back when a suite runs increased significantly.   This was causing the memory problems.  Uncle Bob thought about it and decided that he needed to trim the fat in the protocol.  So he changed the XML that is returned to the TestRunner to be simpler, smaller and more efficient. 

So here I was, I had an approach for running the tests.  They ran.  They returned results without blowing things up.  But Something was missing.  The XML transform from Gregor still ran, but the output was all wrong; it was missing the HTML version of the page results.  To make things more efficient, Uncle Bob had to stop returning the content, as the page content was the source of all our memory problems.  This would have been a real problem, but Uncle Bob didn’t do this without a backup plan.  Earlier this summer, he added the ability to keep the history of a test run and view it.  Leveraging that work, he now returned the path to the history for the specific test run of each page in that execution.

Now I had to do some thinking.  I have the results and I can transform them into JUnit results for Hudson.  But my boss wants to see the HTML pages.  So I think about this.  I have an XML file that has the page address to the history.  It’s not a full URL, just a page reference with a link to the history responder.  So what do I do?  What if I take the XSL transform and modify it.  So I did some quick Googling and tinkering and I ended up with some changes to the XSL file to take the Page reference, build it into a proper HTML link and change the “format=xml” to be “format=html”.  Now I had a HTML page and links.  (I’ll post this file very soon.  Waiting on permission, as I modified the original.)

However, how do I have a persistent FitNesse server running on my Hudson server?  I probably over thought this, but it seemed to me that I needed to have an instance of FitNesse running as a service on the computer just to serve up the history pages when someone goes exploring a failure from Hudson.  I’ll post my version of this for everyone soon in a FitNesse Tip very soon.

Today all I have the energy for is the story.  Very soon I’ll post information on the following things:

  1. The XSL transform that I got to work.
  2. An ANT task that runs FitNesse and transforms the XML results TestRunner saves into an HTML page
  3. My version of the trick of getting FitNesse running as a service on Windows.