≡ Menu

Fitnesse and .NET – a basic tutorial

I’ve been working more with FIT and FITnesse, especially the .NET port. I tried to locate a quick tutorial to get someone up and running on it with a very basic project, but couldn’t seem to come across one. Hopefully this will help you, or someone you love, get Fitnesse hooked into your .NET project for some Testing goodness.

Step 1 – Download and run Fitnesse

First, download the latest version of Fitnesse from http://www.fitnesse.org. The DotNet fitserver comes installed as part of the standard download.

Next, start the FIT server. Browse to it using ${browser.of.choice}. Create a page called MyFirstTest by appending MyFirstTest to your URL like: http://localhost:8080/MyFirstTest

Step 2 – Create a test page

Following the instructions from the DotNetFitServer page (http://www.fitnesse.org/FitNesse.DotNet.DotNetFitServer), edit your page 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.

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

|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.

Step 3 – Create the .NET Class

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.

Step 4 – Hook Fitnesse to the .NET Class

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

Step 5 – Get to Green

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. Now, go forth and get busy with those customer tests!

Comments on this entry are closed.

  • Matt Scilipoti November 25, 2005, 10:46 pm

    Thank you for all your effort!

    I have a question about the Test table format. When I created the Division table in FitNesse, the first line (|Division|) was not rendered as part of the table. I tried a few things and found that entering a space between the ‘goalpost’ (|) and the word “Division” allowed it to be recognized as the ‘Fixture’ for that table (| Division|). Is this expected behavior?

    Also, could you number your steps? It would make it easier to refer to the related section.

    Thanks again, Matt

  • Cory Foy November 26, 2005, 8:42 pm

    Hi Matt,

    Check to make sure there isn’t a space at the end of the pipes. That will cause it as well.

    Thanks for the info – I’ll number the steps, and let me know if the above works for you.

  • Mike Krumlauf January 6, 2006, 2:03 pm

    Everything worked fine when I created my .NET project using Visual Studio 2003, but when I converted the project to Visual Studio 2005, FitNesse could not find the Division class in the assemblies. Have you encountered or otherwise heard of this problem?


  • Mike Krumlauf January 6, 2006, 2:25 pm

    I was able to test .NET 2.0-compiled classes after downloading the FitNesse source and compiling the dotnet portion in VS 2005 and referencing the new FitServer.exe. It might be helpful to pass this information along – thanks for the great tool!

  • Mike Krumlauf January 6, 2006, 2:49 pm

    Not to make myself a pest, but I’m now trying to test a Visual Basic .NET 2.0 version of the Division example in your tutorial, and I get the error “System.ApplicationException: Type ‘division’ could not be found in assemblies.” Is it possible to test VB .NET classes with FitNesse?

    Thanks again.

  • Anonymous January 20, 2006, 10:02 am

    I had the same problem as Matt, but realized there was a space after the first |. I removed it ant it worked.

    I do however now have the same problem mentioned by Mike. It says that it can’t find the type “division”. Well, I noticed there is a case difference, my class and the header of the table are both “Division” but it is looking for lower-case “division”. Any idea why?

    I have release 20050731, which release did you use?

    Thanks, Chris

  • Cory Foy January 21, 2006, 1:27 am

    Hi Mike,

    Sorry about the delayed response. I haven’t played with 2005 yet, but I have done stuff with VB.NET, so I can’t image it not working. You might want to try on the NUnit list to see what they have to say.

  • Cory Foy January 21, 2006, 1:30 am

    Hi Chris,

    First, is your class declaring a namespace? That was a tricky part – if you’re class is in a namespace you’ll have to declare that as part of the name or import it.

    As far as lower vs upper, I don’t think it should matter for .NET – I don’t believe the classes are case sensitive for reflection.

    Does changing it to be lower-case division fix the problem?

    I’ll give it a shot this weekend and see what’s going on.

  • Chris January 31, 2006, 4:37 pm

    Changing the Division to lowercase did not work either. I also tried including the namespace, and it didn’t work. I get the following error:

    System.ApplicationException: Type ‘fitnessetutorialdivision’ could not be found in assemblies.
    Assemblies searched: file:///C:/FitnesseTutorial/bin/Debug/FitnesseTutorial.dll

    at fit.ObjectFactory.GetInstance(TypeName typeName, Assembly assembly, Type type)
    at fit.ObjectFactory.GetTypeOrInstance(TypeName typeName, GetTypeOrInstanceDelegate getTypeOrInstance)
    at fit.ObjectFactory.CreateInstance(String submittedName)
    at fit.Fixture.LoadFixture(String className)
    at fit.Fixture.LoadFixture(Parse theTable)
    at fit.Fixture.DoTables(Parse tables)

  • Chris January 31, 2006, 4:43 pm

    Actually, Cory, it appears that having a namespace is what caused the problem. I can’t get namespaces to work. When I removed the namespace, it started working.

    Thanks for the tutorial, it was a great help.


  • Anonymous February 14, 2006, 6:26 pm

    Great tutorial – saved me a ton of time!

    Now if I could just get you to write a tutorial showing how to implement an ActionFixture using C#…

    Many Thanks!
    Tom H

  • Cory Foy February 15, 2006, 11:01 pm

    “Now if I could just get you to write a tutorial showing how to implement an ActionFixture using C#…”

    Consider it done

  • Paul Vlagsma March 6, 2006, 10:48 pm

    Cory, thank for the tutorial for people, like me, who don’t RTFM.

    I made my Fitnesse & FitLibrary for .Net2.0 following Jeff Mattfield’s excellent instructions.

    I was having trouble getting the VB.Net stuff to work, always getting the System.ApplicationException: Type ‘division’ message, so I had a look at the .dll I was trying to test using ILDASM. (Use Programs, VS 2005, VS Tools, VS Command Prompt, enter ILDASM)

    This shows that the name of the Type is actually the NamespaceName.Division .
    i.e. The class is declaring a namespace as Cory said. 1:30am

    (It seems that, although only one class is defined, the namespace name is placed there because the ‘My’ class is also present in all? VB builds. )

    Entering the full name
    i.e. namespacename.classname
    into the first row of the FIT table makes the test work.

    Don’t forget to insert a ! before the table, or the, probably CamelCase’d, NameSpace name will think it’s a new Wiki page.

  • MarFarMa March 10, 2006, 10:51 am

    Thank you for the lovely tutorials (both this and the actionfixture). I was wondering if you could do own for column fixture – I haven’t been able to get it to work properly, and I think that looking at someone else’s code might help.

  • Anonymous March 14, 2006, 2:06 pm

    Hi there,

    I did what Paul has suggested .with or without namespaces ,I am getting the error that numerator cannot be found in DLL. So does it suggest me that Fitnesse is not working for Net 2.0 Framework.

    Does any one have any suggestions .


  • Anonymous March 14, 2006, 4:23 pm

    Never Mind ,

    It worked with the way Paul has suggested. Make sure that your class is public when you are getting not found Division error.

    Because VS by default will not create as public.

    One more thing if you used namespace in your class ,make sure that you refer that .

    For ex :
    !define COMMAND_PATTERN {%m %p}
    !define TEST_RUNNER {dotnet\FitServer.exe}
    !path dotnet\*.dll
    !path C:\projects\Foo\FitenesseContentStoreTests\bin\Release\DivisionTest.dll

    |10 |2 |5 |
    |12.6 |3 |4.2 |
    |100 |4 |50 |

    and here is the class

    using fit;

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

    public double quotient()
    return numerator / denominator;

    Lastly if you are running on .Net 2.0 be sure to follow the below blog



  • Sujit Raghavan March 29, 2006, 5:01 pm

    Thanks for this effort, saved us a lot of time

  • Paul Vlagsma April 21, 2006, 9:23 pm

    I have ported most of the FitBook examples to .NET 2005.

    see http://www.vlagsma.com/fitnesse

    The fixture & application code in J#, C#, VB.NET as VS 2005 projects.

    The Wiki pages are included. Each individual test page has links to the relevant code.

  • Michael O'donnell August 24, 2006, 7:17 am

    Ok, I have successfully completed the Division sample using C# (2005) and it works (in the end it took just under 4 hours to figure out what was happening). I have tried to replicate the example using vb.net (2005) but I am getting a System.ApplicationException: Type ‘MyFitnessTutorialVB.Division’ could not be found in assemblies.’

    I have followed the same steps as in the C# example. Added my fit.dll, inherited from fit.ColumnFixture, kept my class, global variables and method public. Referenced my projects dll in the bin folder.

    Any suggestions on what the difference between C# and VB.NET examples are?

    Michael O’Donnell.

    (I only found this blog in the last 45 minutes, and it was about that time that things started to go right)

  • Cory Foy August 24, 2006, 7:45 am

    Hi Michael,

    First, can you try the example in VB without your class being in a Namespace? I’ve seen some problems with that before.

    Feel free to email me directly, or head over to the Fitnesse list (http://groups.yahoo.com/group/fitnesse) if that doesn’t work.

    Thanks, and I’m glad it was helpful!


  • Tim January 24, 2007, 7:59 pm

    WARNING! The table code in Cory’s post has a space at the end of the line


    which, if you copy and paste directly into your test page, will produce the error:

    System.ApplicationException: Type ‘numer’ could not be found in assemblies.
    Assemblies searched:
    Load errors:
    at fit.ObjectFactory.GetInstance(TypeName typeName, Type type)
    at fit.ObjectFactory.CreateInstance(String submittedName)
    at fit.Fixture.LoadFixture(String className)
    at fit.Fixture.DoTables(Parse tables)

    This took me a few hours and finally tracing the source code to find and figure out.

    This is apparently another side effect of Division not being rendered/recognized as part of the table.

  • rusty March 19, 2007, 11:12 am

    Yep! If you cut and past, BE SURE TO DELETE THE SPACES AFTER THE PIPES. Otherwise, you get: “System.ApplicationException: Type ‘numerator’ could not be found in assemblies.”

    Also, hilarious, but the third test row is incorrect. 100/4 is 25. But how cool to see that it fails and cause us to think, “is return numerator/denominator; incorrect?”

  • Anonymous April 2, 2007, 3:52 am

    I get this error for some input (string, integer) given to a fixture.

    System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at fit.MethodAccessor.Set(Fixture fixture, Object value)
    at fitnesse.handlers.AbstractCellHandler.HandleInput(Fixture fixture, Parse cell, Accessor accessor)
    at fit.CellOperation.Input(Fixture fixture, String memberName, Parse cell)
    at fit.Binding.HandleCell(BoundFixture fixture, Parse cell, OperationType operationType)
    at fit.Binding.HandleCell(BoundFixture fixture, Parse cell)
    at fit.BoundFixture.DoCell(Parse cell, Int32 column)

    What is the solution for this problem if anyone has encountered this error?

  • Jonathan Mark May 9, 2007, 2:40 pm

    I was having a lot of trouble with “Class Division Not Found.” I switched to Mono and SharpDevelop, compiled the exact same code as I was doing in Visual Studio, and the problem went away.

  • Anonymous July 11, 2007, 4:48 pm

    Very helpful for someone just getting started with Fitnesse. Thanks!

  • Gnome July 11, 2007, 7:12 pm


    Thank you for my sanity!! I was beating my head against a wall just trying to get the Quotient example to run. (The Fitnesse documentation is a real piece!)

    I’m officially out of the starting gate with Fitnesse!

  • Anonymous August 7, 2007, 3:55 pm

    This is an excellent information on getting started on Fitnesse without doubt.
    Only think is to make sure if you are attempting the same project in VS 2005, you need to build the Fitness dlls to 2005.

  • colwin September 12, 2007, 5:17 am

    great tutorial finally got it to work with what i read here

    Few things worth noting though if your using .Net 2.0

    1)download the patched libraries for .net 2.0

    From here
    follow the instructions on the page
    head over to source forge to get the latest release when i checked it was 1.3
    find it here

    2)make sure the class path to your application dll or exe you are testing has no spaces

    3)make sure when you reference the fit.dll from VS 2005 you set the copy local property to false

    there you done Fitnesse is now up and running

  • colwin September 12, 2007, 5:21 am

    hmmm the whole Url wasn’t displayed for the source forge link so here it is again


  • mdemeglio December 5, 2007, 3:32 pm

    I was able to get the .Net 2.0 namespaces to work by escaping the Namespace.Class name by enclosing them between !- and -! as below:


    Hope this helps. I couldn’t get it to work any other way because Fitnesse kept putting a ? in front of the period like FitnesseTutorial?.Division

  • Sheikh Ather Ali January 22, 2008, 11:57 am

    I have a NUNIT TEST FIXTURE, having some TEST methods into it, can anyone tell me how can i REUSE that without having it to rewrite ???

  • ARTHER January 22, 2008, 12:02 pm

    Another question is, how to create that pipe delimited text for complex objects, like for example i need to test a method which takes a BankAccount Object and which has several other objects encapsulated into that, How to create that pipe delimeted stuff for this case ???

  • Suresh June 13, 2008, 6:52 am


    As part of my testing a .net application, I need to output a 2-dimensional array to a cell in the Fit table and verify them. Can anyone help me by providing a solution for this?

    Thanks in advance,

  • HariPriya September 5, 2008, 4:12 am


    Thanks a lot for the basic tutorial. It really helped me .
    I was struggling from 2 days and now able to see all cells in GREEN

    Thanks once again.


  • Anonymous January 13, 2009, 8:57 pm

    i a new guy with the Fit method. So currently want to understand more how it done. Could you please explain to me what do you mean by “add a reference to the fit.dll which is in the dotnet directory of your fitnesse install location. I stuck in this part. Thanks for your help.


  • Anonymous January 14, 2009, 3:34 am

    Hi guys
    i want to know, when ever i click the button test, this massage will come out ‘Fitserver for Fitnesse.net has stop working’. What it mean?

  • Anand April 1, 2009, 8:59 pm

    Hi Cory,
    I fed up with executing the dot net fixture. I did not get any help from my team to do this. When googled for this. I got ur notes. It is very good. realy I have danced. Thanks

  • podpisani.pl July 18, 2009, 7:03 pm

    how the fit.ColumnFixture on the every solution class impact the performance?

  • Founder September 18, 2009, 8:26 am

    A test in wiki and a fixture class in .net.

    The test works if a use only one captial char in the classname: Candividenumbers

    but these combination arn’t working:

    Looks like FIT uses the capital char to determine the namespace? Is there a fix for this?

  • Founder September 18, 2009, 8:27 am

    Founder :
    A test in wiki and a fixture class in .net.
    The test works if a use only one capital char in the classname: Candividenumbers
    but these combination arn’t working:
    Looks like FIT uses the capital char to determine the namespace? Is there a fix for this?

  • pretid October 5, 2009, 9:08 am

    you should change your tutorial and put the namespace in your wiki test page (it’s easier i think…)

    Great tut !

    Thanks a lot

  • Vish December 9, 2009, 4:10 pm

    I have a question on the remote usage. If I have the wiki on a remote box and would like to run the test against my local code how can i do that ? It seems that defining path on the test page has to be a local absolute physical path. How do you envision it in an enterprise framework ? Also how to automate these tests ?

  • David Campey February 18, 2010, 5:02 am

    Ran through the tutorial last night, it worked, thanks!

    Notes on my experience here:

  • David April 8, 2010, 5:53 am

    I tried this sample but getting following errors, im using VS2008

    How do i check if i have fitserver
    all the steps i have done above

    java.io.IOException: Cannot run program “dotnet\FitServer.exe”: CreateProcess error=2, The system cannot find the file specified
    java.lang.ProcessBuilder.start(Unknown Source)
    java.lang.Runtime.exec(Unknown Source)
    java.lang.Runtime.exec(Unknown Source)
    java.lang.Runtime.exec(Unknown Source)
    java.lang.Thread.run(Unknown Source)

  • tcmaster May 27, 2010, 9:47 am

    To David, change the dotnet\FitServer.exe to full path of your fitserver. e.g. c:\fit.net\someversion\fitserver.exe

    if you still don’t get it, quit the industry and find another job :)

  • pin June 7, 2010, 3:25 am

    Hi there,

    stumbled upon the namespace problem as well. The problem is that the namespace name FitnesseTutorial is a wiki word and thus will be changed by the wiki program. To avoid this, simply put an exclamation mark “!” in front of the fixture, e.g.:



  • Jeff August 19, 2010, 11:21 am

    If any n00bs (used to a windows/.net environment) and got stuck on “Step 1 – Download and run Fitnesse” and haven’t figured out how to get the fitness webstite running (like me), here’s what you need to do:

    From the Fitness homepage (http://www.fitnesse.org), head to the “Download FitNesse and Plugins” topic, then you’ll see a list of links to .jar & .zip files – as well as links to plugins. I was looking for the .net port of the project so I was hunting around in the .Net Fit download file and couldn’t figure out how to get the webserver running (there’s even a FitServer.exe file in the download – how confusing!).

    After some struggling, I figured out that you need to first download the latest .zip file listed in the page (eg fitnesse20090513.zip), unzip the files, make sure Java is installed – since that’s what the Fitness server actually runs on – and then you can run the run.bat file in the root of the unzipped folder. After getting that to work, I then downloaded the latest .jar file (eg fitnesse.jar from the 20100303 folder) and put it in the root of the same unzipped folder (it’ll replace the existing file from the zip unless you rename the original). Then you can run run.bat again and it’ll do some work before loading the server process into memory. If you have IIS running, you’ll see the error that you need to specify an unused port, so you can execute the batch like “run.bat -p 8080” for example to get the server running on port 8080 like shown in the tutorial.

    You might be able to avoid the .zip file altogether and just download the latest .jar and run the “java -jar fitnesse.jar” command to get things going, but I’m not too familiar with things yet to say for sure and have found some nuggets worth exploring in the unzipped contents folder.

    Hope this helps someone with the same limited experience I had!

  • mani May 16, 2012, 2:24 am

    when ever i try make sm changes in the properties or edit and click on save button ; the tool promts for credentials.Plz let me know abt this ASAP.Thank you in advance!

  • Manoj July 1, 2013, 2:53 am

    I have executed my fitnesse framework in port 8088 and it shows the result. If i close the server and open it again in same server it couldn’t execute the result. It throws an error. Anybody have solution for that?