Click here to Skip to main content
12,762,900 members (36,980 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


28 bookmarked
Posted 8 Dec 2007

An Introduction to Fit and Fitnesse

, 9 Dec 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
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.

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:

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:

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:

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:

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.

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

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.

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:

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.

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
I am the founder of knowledge base website, HighOnCoding, GridViewGuy, and

HighOnCoding is a website which will get you high legally with useful information. There are tons of articles, videos and podcasts hosted on HighOnCoding.

My Blog:


Buy my iPhone app ABC Pop

You may also be interested in...

Comments and Discussions

GeneralNice work Pin
Karl Shifflett10-Dec-07 18:45
memberKarl Shifflett10-Dec-07 18:45 
Nice work explaining these products. I checked out your sites, WOW, that is a lot of fine work sir!

Have a great day,

Cheers, Karl

Just a grain of sand on the worlds beaches.

GeneralRe: Nice work Pin
azamsharp11-Dec-07 5:25
memberazamsharp11-Dec-07 5:25 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 9 Dec 2007
Article Copyright 2007 by azamsharp
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid