Chapter 2. Installing FitNesse

FitNesse is a great tool for collaboration and testing, and has many nice features that will help us work more efficiently and produce better software. For a .NET environment, FitNesse works in combination with several software tools and frameworks, which you'll have to download and install separately. So, in order to set up a working server, you must get your hands a bit dirty, but the effort will be well worth it. Before diving into the world of automated acceptance testing, you'll need to set up everything and run a quick sanity check to make sure that your new tool is working correctly.

FitNesse is a web application with its own server written in Java.[3] It uses a .NET version of FIT test runner (a Windows .NET executable) internally to execute .NET tests. The test runner must be downloaded separately. So, to use FitNesse for testing .NET code, you need:

Setting up FitNesse

There is no special installation procedure for FitNesse. Just save the JAR file downloaded from FitNesse.org somewhere on your disk. I suggest opening a dotnet2 folder next to that JAR file, and unpacking FitSharp there. This path is used in the examples in this book. If you put .NET runner somewhere else, remember to change the path in code examples.

Start FitNesse by executing java -jar fitnesse.jar from the main FitNesse folder (either via command line or double-click). FitNesse works as a web application with its own web server and tries to open port 80 by default. If this port is already taken on your machine, add -p 8888 to the end of the command before executing it. You can replace 8888 with some other free port on your system. I use 8888 in the examples, so if you use another one, remember to enter the correct port when you try out the examples. When FitNesse starts, you should see a command window with this message:

FitNesse (20091121) Started... 
	port:			8888 
	root page:		FitNesse.wiki.FileSystemPage at ./FitNesseRoot 
	logger:			none
	authenticator:	FitNesse.authentication.PromiscuousAuthenticator html page
	factory:		FitNesse.html.HtmlPageFactory 
	page version expiration set to 14 days.
[Tip]Do I have to use .NET 3.5?

FitSharp requires .NET 3.5. You can use the older FitNesse.NET runner with .NET 2. All the examples in this book will still run, with some minor configuration changes. See http://sourceforge.net/projects/fitnessedotnet for more information.

Open http://localhost:8888/ and you should see the welcome page (Figure 2.1, “FitNesse welcome page”).

FitNesse is up and running. When you want to shut it down later, just press Ctrl+C in the command window (or close the command window).

[Tip]The command failed. What's wrong?

Read the exception from the command window. If the error mentions versions, check that you have Java 6 installed and that the correct version is being executed when you run java.exe. Run java.exe -version from a command window to see which version of Java is being executed by default. You can run FitNesse with a different Java version either by pointing to the correct JVM in the system executable path (right-click My computer , select Properties, then go to Advanced tab, click Environment Variables, and edit the Path variable), or by entering the full path to a different java.exe in the command line.

If the error report states that there is a security problem or the port is unavailable, use a different port number (-p 8888) and try again.

If the error report is “Unrecognized option: -p”, you must have added -p 8888 before the jar file name, so put it after other options.

[Note]Stuff to remember
  • In order to connect to .NET projects, you have to tell FitNesse to use a .NET test runner (Runner.exe) and specify the path of your project DLLs.

  • We describe tests in tables containing both test parameters and expected results.

  • The table header specifies the test class name.

  • Put an exclamation mark at the beginning of every table to protect table data from wiki formatting.

  • If a test fails, FitNesse shows both expected and actual outcome.



[3] Actually, while I was writing this, Gennadiy Donchyts published an experimental .NET port using IKVM. I haven't tried this yet. See http://don.env.com.ua/blog/?p=57 for more information.