On any software project, what is our ultimate goal? Beyond the language, beyond the proofs, beyond the code, it is to provide value to your customer. This customer might be a paying client, it might be your organization, it might even be yourself. And the way to provide value is to give them what they want - which isn’t always what they say they want upfront.

So, if we want to provide real value to our customers, and they may not know what they want upfront, then it would seem like the only way to achive our goal is by providing rapid feedback and staying agile enough to let the software evolve in a way that meets our customers needs - even if they are discovering their needs as we go. This concept of responding to change is the core of the principles behind agile methodologies such as Extreme Programming. Keep the lines of communications to the clients open, and you’ll find out how to deliver what they really want.

Fitnesse is an open-source project which aims to help make that feedback loop between your customers and your software more interactive. It does this by combining the concept of Customer Tests with a technology that end-users can learn - a Wiki. It builds off the FIT libraries which allows people to create HTML tables and Spreadsheets that they could run tests in. It can hook into a variety of backends, including Java, .NET, Python and many others.

For this article, I want to focus on the .NET version of the Fitnesse framework. We’re going to hook a Fitnesse page up to a .NET project to show how straightforward it is. A lot of this came from a recent post from my site.

First, we’ll need to download the latest version of Fitnesse from http://www.fitnesse.org. The DotNet fitserver comes installed as part of the standard download. Run the installer - I installed it to C:\Fitnesse.

Next, start the FIT server. Do this by going to the install directory and running run.bat. (Browse the docs if you need to run it on a different port than port 80). Browse to it using ${browser.of.choice}. You should see the Fitnesse welcome page. Now, create a page called MyFirstTest by appending MyFirstTest to your URL like: http://localhost/MyFirstTest

Following the instructions from the DotNetFitServer page, edit your page by clicking on the Edit button and add the following lines:

!define COMMAND_PATTERN {%m %p}
!define TEST_RUNNER {dotnet\FitServer.exe}
!define PATH_SEPARATOR {;}

This hooks your wiki to the FitServer runner which is in the dotnet directory from your install directory (using the directory from above, it would be at c:\Fitnesse\dotnet).

Now, add a test. We’ll use the normal division test. Add the following lines to your wiki page:

|Division| 
|numerator|denominator|quotient?|
|10       |2          |5        |
|12.6     |3          |4.2      |
|100      |4          |24       |

Now save it. It should look something like:

You’ll notice that you don’t see a “Test” button on the left hand side menu. This is because you need to tell Fitnesse this is a test page. Click on Properties, check “Test” under actions, and click “Save Properties”. You’ll now see the Test link show up on the left hand side menu. Click it! You should now see something like:

Which is Ok, because we haven’t defined an assembly. In fact, we haven’t done anything yet with .NET. So, our next step is to create a .NET project to run our code. Open Visual Studio.NET, and create a new class library project in a location that doesn’t have any spaces, like C:\FitnesseTutorial.

Once that is open, delete the Class1.cs file. Next, add a reference to the fit.dll which is in the dotnet directory of your fitnesse install location. For me, that is c:\fitnesse\dotnet\fit.dll. Now add a new class, Division, which inherits from fit.ColumnFixture. Notice that is the same name as the first row from the table we put in our wiki. Your class should look like:

public class Division : fit.ColumnFixture
{
  public double numerator = 0.0;
  public double denominator = 0.0;

  public double quotient()
  {
    return 1.0;
  }
}

Save and build that project. Now we have to get the wiki to “see” our class. This is accomplished with the !path line, so edit your wiki page and add the line:

!path C:\FitnesseTutorial\bin\Debug\FitnesseTutorial.dll

and save it. Now try running your test again. You should see something like:

Yay! Do a dance, or a jig. This means you have everything hooked up properly. If you are running into problems make sure:

  • You don’t have a namespace
  • You’ve specified the full path to your output dll
  • Your class extended fit.ColumnFixture

Now that you are here, modify your class to let this test pass:

public class Division : fit.ColumnFixture
{
  public double numerator = 0.0;
  public double denominator = 0.0;

  public double quotient()
  {
    return numerator/denominator;
  }
}

Assuming everything has worked up to this point, you should now see the following:

And that’s it! You’ve now succesfully modified a Fitnesse page to use the DotNet fit server and talk to a project you created.

So, as you can see, Fitnesse allows you and your customers to create tests that, using some basic Wiki code, can talk to a variety of backend systems. More and more companies are using Fitnesse tests as a way to have executable specifications so that they can watch the progress of the system as it is built. Finally, it can allow them to explore assumptions and easily point them out to the development team as necessary.

How can you make your customer feedback loop more engaging?