Fri 25 Nov 2005
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?





May 21st, 2006 at 2:38 pm
hotel california
Judaism antitoxins,antithetical chap tiger,affix praiseworthy!hotels new york http://hotels-new-york.hotels-beaches.com/
July 14th, 2006 at 9:09 am
tantra massage new york
Well … again a nice post .
November 22nd, 2006 at 2:23 am
Good demonstration… keep it up:)
March 5th, 2007 at 7:21 pm
System.ApplicationException: Type ‘numerator’ could not be found in assemblies.
Assemblies searched:
at fit.ObjectFactory.GetInstance(TypeName typeName, Assembly assembly, Type type)
at fit.ObjectFactory.GetTypeOrInstance(TypeName typeName, GetTypeOrInstanceDelegate getTypeOrInstance)
at fit.Fixture.LoadFixture(String className)
at fit.Fixture.DoTables(Parse tables)
I verified:
Code compiled
no namespace
correct path to dll
not sure what I’m missing.
April 24th, 2007 at 10:57 am
I had the same error System.ApplicationException: Type ‘numerator’ could not be found in assemblies.
When I looked at my table on my wiki, ‘Division’ was showing up as |Division|, instead of the top row of the table with ‘Division’ in it. Once I got this fixed, worked like a champ.
May 3rd, 2007 at 9:27 am
We’re running the dotnet2 dlls and having an interesting issue.
We have 2 sets of 2 test runs using “Division”
Set1, Test run 1 : Run Division on localhost using the web page and dotnet2\FitServer.exe
Set1, Test run 2 : Run Division on localhost using the command line and dotnet2\TestRunner.exe
Set2, Test run 1 : Run Division on buildserver using the web page and dotnet2\FitServer.exe
Set2, Test run 2 : Run Division on buildserver using the command line and dotnet2\TestRunner.exe
Set1, Test1 : Pass
Set1, Test2 : Pass
Set2, Test2 : Pass
Set2, Test2 : Fails with:
System.ApplicationException: Type ‘MyTestNameSpace.Division’ could not be found in assemblies.
Is there some kind of permissions issue with the build server that could be causing this issue?
May 21st, 2007 at 8:10 pm
i posted the request. its very urgent.
July 29th, 2007 at 11:19 am
Took me about 8 hours to finally get this to work. I needed a patch for this to work for .Net 2.0. Might be a good thing to mention in the blog. I was thankful for a tutorial to get started. The Fitserver.exe that is downloaded with the Fitnesse bundle does not seem to work with Visual Studio 2005. I googled to find a solution.