Thursday, August 4, 2011

Updating FitNesse for color blind users

The importance of designing for the color blind has always been at periphery of my awareness while building applications but was recently brought to the foreground when presenting a suite of Fitnesse test results to my boss. When he asked how to determine whether a test passed or failed, I was a little puzzled by the question. I thought the red and green colors were quite obvious. That's when he had to remind me that he is color blind (most likely protanopia or a variant, as red/green seems to be particularly problematic).

Of course, I was embarrassed at neither remembering this nor coming up with a solution before having it pointed out. Nonetheless, I remembered when first getting acquainted with Fitnesse a mention of customization of the stylesheets in the user guide.

Digging around a bit, I discovered a very simple solution. I created two png files, pass.png and fail.png and placed them in c:\fitnesse\files\images. Then I modified c:\fitnesse\files\css\fitnesse.css as follows:
@import url( "/files/css/fitnesse_base.css" );

.pass {
background-color: #AAFFAA;
padding: 0px 0px 0px 20px;
background-image: url("../images/pass.png");
background-repeat: no-repeat;

.fail {
background-color: #FFAAAA;
padding: 0px 0px 0px 20px;
background-image: url("../images/fail.png");
background-repeat: no-repeat;
zoom: 1;

#test-summary {
padding: 0px 0px 0px 20px;

Wednesday, July 27, 2011

Using FitNesse and TFS

Getting Fitnesse to work with an external source control system is not possible "out-of-the-box," though it does implement a source control provider interface that supports other providers. Thanks to Lars-Erik ?, there is a FitNesseTFS plugin available on SourceForge.

  1. This is an alpha product, and we've only tested it for a couple of weeks so far. Your mileage may vary.
  2. All users will be editing the same instance of fitnesse. There is no way to track who made changes to the wiki (all changes will be committed as the account under which the service runs), and there is no way to provide commit comments.

On the fitnesse server:
The first thing to do is to edit your path environment variable to include the path to TFS (for me, C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE) and Java (C:\Program Files (x86)\Java\jre6\bin).

I'll assume a Fitnesse root of c:\fitnesse.

Download the latest Fitnesse jar file.

Open a command prompt and run java -jar fitnesse.jar -p 8080 -e 0. This will run the Fitnesse unpacking process to give you a base install (and disable built-in versioning). Once it's done, close the command window.

Create a plugins folder at c:\fitnesse\plugins. Add the fitnesseTFS jar file.

You'll want Fitsharp, so download it and add the binaries to c:\fitnesse\fitsharp.

Run java -jar fitnesse.jar -p 8080 -e 0.
Run tf.exe workfold $/Infrastructure/fitnesse c:\fitnesse
Run tf.exe get c:\fitnesse /noprompt /all /overwrite /force /recursive
Run attrib *.* -R /S

Open a browser and navigate to http://localhost:8080/root

Click the edit button and enter the following:
!define TEST_SYSTEM {slim}
!define COMMAND_PATTERN {%m -r fitSharp.Slim.Service.Runner,c:\fitnesse\fitsharp\fitsharp.dll %p}
!define TEST_RUNNER {c:\fitnesse\fitsharp\Runner.exe}
!define CM_SYSTEM {fitnesseTfs.SourceControlPlugin C:\Users\me\Documents\Fitnesse\ "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\"}

Click the Save button, and close your browser.

Follow the instructions in this article to set up fitnesse as a service.

For developers who need to work locally,
  • get latest from TFS on the Fitnesse project
  • Run the following:

  • cd c:\fitnesse
    attrib *.* -R /S
    java -jar fitnesse.jar -p 8080 -e 0

  • Start a browser and navigate to http://localhost:8080/FrontPage

  • Click the Properties button

  • In the Remote Wiki Url text box, enter the path to the server's wiki (something like http://buildserver:8080/FrontPage).

  • Check the Automatically update imported content when executing tests checkbox, then click the Import button.

You can now work on a local version of the fitnesse wiki while you work on fixtures without impacting other users.