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.

Caveats:
  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.

1 comment:

Anonymous said...

Any information on integrating Fitnesse with TFS and invoking the scripts during the build process?