FitNesse is the tool we use to specify our Acceptance Criteria.
To debug a FitNesse test where glue code is written in C# or any other .Net language, there are several possible options:
- Specify FitNesse TestRunner.exe as an external program in the debug properties of your glue code project. See this blog post: Debugging FitNesse Tests
- Put a “Thread.Sleep(5000);” in your glue code so that you have 5 seconds to attach your Visual Studio to the process that executes your tests (FitServer.exe)
- Use the plug-in written on TestDriven.Net. You may have to recompile it depending on the version of TestDriven.Net you use, but it works.
- Use GFlags.
- …
My favorite option so far to debug FitNesse tests is using GFlags because it’s really simple and doesn’t require any code changes.
All you need to do is to make 2 registry files, for example:
- AttachDebuggerToFitserver.reg, containing:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\fitserver.exe]
"Debugger"="vsjitdebugger.exe"
- DetachDebuggerFromFitServer.reg, containing:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\fitserver.exe]
"Debugger"=""
If you want to debug FitNesse, execute the first file. When you run the tests in the Wiki, a debug window will pop-up, and you can attach your Visual Studio Solution containing the glue code.
If you want to disable the debugging again, just execute the second file.
I saw this possibility for the first time on TechEd Barcelona 2006 in a Hardcore Debugging session by Ingo Rammer. Ingo used it to debug a Windows Service which failed at startup.
Final tips:
- Also commit this 2 files into your code repository, so that your colleagues can use them. Don’t keep these precious things for yourself.
- Add this 2 little reg files to your Launchy catalog. Then you can start/stop debugging FitNesse by hitting <ALT>+<ENTER> and typing for example “debugfit” or “stopdebugfit”.
Just try it, it’s really simple and effective.



