FitNesse with .Net
June 29, 2011 3 Comments
Why another tutorial on installing and using FitNesse with .Net? Well, because I had a lot of trouble installing and using FitNesse with .Net. That may be an issue with the existing tutorials, or, it be an issue with me. Hopefully with these posts I can spare you some of the pain I encountered.
First things first. The source for all things FitNesse is here. There you’ll find lots of tutorials, samples and other useful info. In fact, if you stick at it you’ll get up and running using just the information on that site, but if you’re in any way like me you may find you slip off the happy path a few times. That’s where the tutorial you’re reading comes in.
History
Before you wrap your head around FitNesse, it helps to have an understanding of where it came from. The Framework for Integrated Testing (FIT) was developed by Ward Cunningham. The origins of FIT go back to a project where Cunningham discovered that he could allow users to enter test scenarios into a spreadsheet, and with a bit of coding he could make those test scenarios execute against the project code.
FIT is a publicly distributable version of that idea. Requirements can be written in a standard word document. Specific “examples” or “Test Cases” are created as Tables, and FIT enables us to hook that document up to executable code, run the tests and actually insert the results back into the Word Document.
FitNesse takes this notion a step further and provides a self contained Wiki complete with it’s own web server. Requirements can be entered into the Wiki or edited by anyone with access. A number of styles of tables give a means of demonstrating requirements using Sample Data. Like FIT, the FitNesse wiki can be “run” against our code base, and the results of tests inserted back into the Wiki.
Fit and SLiM
Originally FitNesse used Fit as a means of hooking the tests (in the Wiki) up to executable code. Later the developers of FitNesse set about replacing Fit. The result was SLiM.
Either Fit or SLiM can be used and some would argue that they each have benefits. As I progress through this series of posts I will cover both options.
I’ll begin with SLiM, for no other reason than I found it very easy to get started with when I first approached FitNesse. When we’re comfortable using FitNesse with SLiM we’ll cover some of the same ground using Fit and explore where the two approaches differ.
FitNess in Action
So, enough waffle, what does FitNesse look like in practice? The following screenshot shows a Decision Table, just waiting to be run. A Decision Table is one of a number of different types of tables that FitNesse/SLiM provides as a means of capturing, or to be more accurate, illustrating requirements through tests.

The eagle eyed among you will notice that one of those examples looks like it’s expecting the wrong result. When we run our tests that should give us something worthwhile to look at.
Take a look at the left Nav Bar, most of those buttons do interesting things, but for now we’re just interested in the ‘Test’ button. If we click it, our FitNesse tests spring to life, execute themselves against our code base, fill in the results in our table, and highlight the passes and fails in green and read. Or to say it more simply with a picture…this happens…

Notice that one of the tests turns red. Dividing 100 by 4 doesn’t give 26. This isn’t highlighting a bug in the code, it’s highlighting a bug in the test, which can and does also happen from time to time. The point here is that when our expectations aren’t met, we’re told about it.
What just happened?
How did the table know where to find our code and execute it?
How does it communicate with our code, passing parameters to the code, and getting back results? What’s all the text at the top of the screen about?
These and many more questions will be answered during this series of posts. I hope you’ll stay with me. Next up, we install FitNesse and a few more bits and pieces that we need to make it play nice with .Net languages like C#.
Fit Tables and SLiM Tables
Before I close this post let me return to that issue of Fit vs SLiM once more. A big practical difference between the two is the types of tables we can use to define tests. In the example above we used a Decision Table which is a feature of SLiM. The Equivalent Fit table is known as a ColumnFixture.
We’ll start by working through all the tables that SLiM has to offer, then we’ll work through the equivalent Fit tables.









