Click here to Skip to main content
15,034,598 members
Articles / Programming Languages / C#
Posted 8 Dec 2007

Tagged as


28 bookmarked

An Introduction to Fit and Fitnesse

Rate me:
Please Sign up or sign in to vote.
4.62/5 (8 votes)
9 Dec 2007CPOL5 min read
FIT introduces a table based structure minimizing the gap between clients and developers


Building a better software depends heavily on how well you communicate with your client. Unfortunately, most of the clients are not tech savvy and hence the domain logic becomes a communication barrier between the client and the developer. If only there was such a system that could easily be understood by both the clients and the developers. FIT tries to minimize this gap by introducing the table based structure hence minimizing the gap between the two species.

What is FIT?

FIT stands for (Framework for Integrated Tests) and it allows developers to work closely with clients. The reason for this closeness is not love or affection but the simplicity of FIT and Fitnesse to parse and produce results understandable by the clients.

What is Fitnesse?

Fitnesse is a tool which uses the Fit framework to produce readable results. It is a Wiki which allows developers to create their pages and edit the content. I will explain the details later in the article.

Installing Fit and Fitnesse?

I will be honest with you. I had a hard time finding the correct .NET 2.0 compatible DLL. I don’t want readers to go through the same experience, hence I am posting links to the URLs below:

If you notice, the Fitnesse download is a binary patch. I got my tests working using this patch.

Discussing the Scenario

Before we dive into the details of Fit and Fitnesse, let’s first talk about the scenario that we are going to solve. Our client needs a simple application that will keep track of the check-in and check-out time of the employees. The application will also display the pay rate, number of hours worked and the pay collected for the day.

The first thing you need to do is to schedule a meeting with the client in which you will discuss the details of the application. During the meeting, you will draw a table to show sample data. The drawing of the table on paper is your communication with the client. You won’t open an IDE and start typing the unit tests because the client won’t understand the code. You can however communicate with the client using a spreadsheet since most people understand the table layout. Check out the image below where the developer and the client discuss the application using an Excel spreadsheet.

Image 1

The above Excel spreadsheet describes what the client wants in the application. This is the expectation of the client or the client’s view of the application. Now, that we have the basic idea of the application and also some sample data, we can write tests against the data provided by the client.

Starting the Fit Server

First, you need to start the Fit server. Simply browse to your Fit folder and find the run.bat file. Now, using the command line, issue the following command:

Image 2

This will start the fit server on port “8888”. To verify that the fit server has started, browse the following URL: http://localhost:8888/.

You will see the homepage for Fitnesse:

Image 3

Good! You got the Fit server running and you got Fitnesse setup to run the tests. Now, let’s export our data from Excel to the Fitnesse page.

Creating a New Page for Tests

It is a good idea to organize your test, hence we are going to create a new page for our TimeSheet tests.

Type the following in your address bar: http://localhost:8888/timesheet.

You will see the following result:

Image 4

This is interesting! Fitnesse should have asked us to create a new page since it does not exist. Let’s try a different approach: http://localhost:8888/TimeSheet.

This time you will see the following page:

Image 5

Interesting! Now, it displays the options to create this page. It seems like Fitnesse follows the two word format in which both words are joined together with their first letter capitalized like FooBar, HelloWorld, ByeBye, SomeThing etc.

When you click on “Create this page”, you will be redirected to a page with a large textbox so you can enter your expected data.

Image 6

Editing the Edit Page

The first thing you need to do is to copy and paste the Excel file which you and the client created into the “Edit Box”.

Image 7

The above image shows the data I just copied and pasted from Excel into the Edit Box. Now, click on “Spreadsheet to Fitnesse” button and it will convert the data into a Fitnesse format.

Image 8

I know I have pasted a lot of things in the Edit Box so let me explain all of them. First the Excel data is converted into the Fitnesse format which looks like the following:

|9:00 AM|5:00 PM|7|8|56|
|10:30 AM|12:30 PM|4|2|8|
|9:45 AM|12:30 PM|10|2.45|24.5|
|9:05 PM|3:30 PM|7|6.25|43.75|

Then I placed the name of the class above it. This will be the class in C# or VB.NET.

|9:00 AM|5:00 PM|7|8|56|
|10:30 AM|12:30 PM|4|2|8|
|9:45 AM|12:30 PM|10|2.45|24.5|
|9:05 PM|3:30 PM|7|6.25|43.75|

Finally, I pasted some configuration settings.

!define COMMAND_PATTERN {%m %p}

(The COMMAND PATTERN tells Fitnesse to start Java. 
You can also use Python by supplying the following command pattern
 !define COMMAND_PATTERN {python "%m" %p}

!define TEST_RUNNER 
{C:\Documents and Settings\Azam\Desktop\fdnpatch20070322-binaries\dotnet2\FitServer.exe}

This is the path for the .NET 2.0 assembly which helps us to run tests against the .NET 2.0 Framework.

!path C:\Projects\DemoFIT\DemoFITSolution\TestLibrary\bin\Debug\TestLibrary.dll

This is the library which contains the tests.

Click the “Save” button and you will see our data in a table format as shown in the image below:

Image 9

Now, let’s create the C# class which will run these tests.

Creating the Testing Class

Create a class library project and then add a class named Timesheet (This is the same name we used in your Fitnesse edit box). Add a reference to fit.dll. Your class Timesheet must inherit from the ColumnFixture class as shown below:

public class Timesheet : ColumnFixture

Let’s check out the complete implementation of the Timesheet class:

using System;
using System.Collections.Generic;
using System.Text;
using fit;

    public class Timesheet : ColumnFixture
        public DateTime checkintime;
        public DateTime checkouttime;
        public double rate;
        public double pay()
            return (rate * hoursworked());

        // returns the number of hours worked
        public double hoursworked()
            TimeSpan t = checkouttime.Subtract(checkintime);
            double s = ((double)t.Hours) + ((double) t.Minutes / 100);
            return s;


I have used public variables to represent the columns in the Fitnesse table and methods to represents the “?” (expected) data. I have two methods pay and hoursworked.

Now, let’s see how to run tests.

Running the Tests

Browse to the http://localhost:8888/TimeSheet page and click on properties. Now, check the “Test” checkbox and click “Save Properties”. Now, you will see a “Test” button on the left side of the menu. Click the test button and it will run the tests. Here are my results after running the tests.

Image 10

You can see from the image above that one of my tests failed. This failed because I accidentally entered the wrong data. The input “9:05 PM” should have been “9:05 AM”. Once, you have corrected the data all the tests will pass successfully.


Fit and Fitnesse allows clients and developers to communicate in an understandable format. This results in better software and hence happy clients and developers.

I hope you liked this article! Happy coding!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
United States United States
My name is Mohammad Azam and I have been developing iOS applications since 2010. I have worked as a lead mobile developer for VALIC, AIG, Schlumberger, Baker Hughes, and The Home Depot. I have also published tons of my own apps to the App Store and even got featured by Apple for my app, Vegetable Tree. I highly recommend that you check out my portfolio. At present I am working as a lead instructor at DigitalCrafts.

I also have a lot of Udemy courses which you can check out at the following link:
Mohammad Azam Udemy Courses

Comments and Discussions

QuestionHow to mail fitnesse test result Pin
Krishna Yadav27-Jan-18 8:11
MemberKrishna Yadav27-Jan-18 8:11 
GeneralMy vote of 3 Pin
Member 1142274620-May-15 21:55
MemberMember 1142274620-May-15 21:55 
GeneralA new tool is now available and is greater than Fitness Pin
Mystcreater10-Mar-09 0:30
MemberMystcreater10-Mar-09 0:30 
GeneralSimple and Very Effective Pin
X204012-Dec-07 21:28
MemberX204012-Dec-07 21:28 
GeneralNice work Pin
User 27100910-Dec-07 17:45
MemberUser 27100910-Dec-07 17:45 
GeneralRe: Nice work Pin
azamsharp11-Dec-07 4:25
Memberazamsharp11-Dec-07 4:25 
Generalvey sharp indeed Azam Pin
Sacha Barber10-Dec-07 9:38
mvaSacha Barber10-Dec-07 9:38 
GeneralRe: vey sharp indeed Azam Pin
azamsharp11-Dec-07 4:24
Memberazamsharp11-Dec-07 4:24 
GeneralVery good introduction Pin
Sven Grand10-Dec-07 8:36
MemberSven Grand10-Dec-07 8:36 
GeneralRe: Very good introduction Pin
azamsharp11-Dec-07 4:24
Memberazamsharp11-Dec-07 4:24 
GeneralRe: Very good introduction Pin
liuchao31820-Oct-08 22:22
Memberliuchao31820-Oct-08 22:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.