How to version FitNesse acceptance tests (yes, the wiki pages) – level 300

Follow this post to easily version your FitNesse wiki acceptance tests (or any other tree of files).

The product manager and his crew will use the FitNesse wiki to author and maintain acceptance tests for the system.  These tests are stored in files on the FitNesse server.  This presents a unique problem of backing up and versioning the tests.  The wiki itself supports 15 levels of modifications, but we use Subversion as the standard versioned backup at the company, so we’d like the acceptance tests to go there.

Here is how we solved this problem:

We created a new project in CruiseControl.Net to watch the wiki.  Call it WikiWatcher.  This project uses “filesystem” as it’s source control to watch.  We point this at the FitNesse directory, and CC.Net will react when any of the files there change.  CC.Net then kicks of a Nant script, and that gives us all the power we need.  In Nant, we run two <exec/> task.  The first adds any files not currently in SVN, and the second commits the files.  NantContrib only provides update and checkout tasks for SVN, so we had to hit svn.exe directly with some command line arguments.  This system works well, and within 60 seconds of a Wiki modification, the changes are versioned and backed up in SVN.  (The CruiseControl.Net documentation can fill in any gaps you may have)

Here is the CC.Net config section that defines our project:

<!– this project watches the fitnesse wiki and backs things up in subversion –>
  <project name=”WikiWatcher”>

      <intervalTrigger seconds=”60″ />


    <labeller type=”defaultlabeller”>

    <sourcecontrol type=”filesystem”>

        <executable>c:<some path>trunkbinnantNAnt.exe</executable>
        <baseDirectory>c:<some path>trunk</baseDirectory>


      <xmllogger />


This is pretty simple.  Just add the above as a CC.Net project node, and you’re off to the races.  The Nant script is even simpler.
Here’s the Nant script:

<?xml version=”1.0″ encoding=”utf-8″ ?>
<project name=”WikiWatcher” default=”commit” xmlns=”“>
 <property name=”baseWikiDir” value=”C:fitnesse”/>
 <target name=”commit” description=”Commits entire wiki directory to source control”>
  <fileset basedir=”${baseWikiDir}” id=”wikiFiles”>
   <include name=”**”/>
  <echo message=”My build ran”></echo>
  <exec program=”c:program filessubversionbinsvn.exe”
        commandline=”add –force *.*”
        workingdir=”${baseWikiDir}” />
  <exec program=”c:program filessubversionbinsvn.exe”
        commandline=”ci -m&quot;automatic checkin&quot; –username <some user> –password <some password>”
        workingdir=”${baseWikiDir}” />

This adds and commits all FitNesse files to SVN, and we’re done.