Slim .net: How do I debug test fixtures using visual studio?
Asked Answered
I

3

6

I've figured out how to run my tests from the commandline using:

java -jar fitnesse.jar -c MyFixturePage?test&format=text -d "c:/utils/fitnesse/" -r "FitNesseRoot"

Using this as the startup parameters for my Fixture assembly project in visual studio does not work. I'm using the Slim runner and executor in my fixtures : http://github.com/jediwhale/fitsharp/downloads

Has any one worked out how to get debugging with Slim working in Visual Studio?

Iridium answered 25/6, 2010 at 10:4 Comment(0)
S
5

The problem is that java spawns another process where your .NET code gets executed and then that process shuts down right away. Here's a way to get a hold of the process where the .NET code runs:

http://www.asoftwarecraft.com/2010/01/troubleshooting-with-fitsharp-and.html

Scull answered 25/6, 2010 at 15:32 Comment(2)
Thank you Mike, perfect solution. Guess I should have read the manual :) syterra.com/Slim/DebuggingFixtures.htmlIridium
In case that link ever dies, the idea is to edit your test page to change the test runner from Runner.exe to RunnerW.exe. eg If you have the following test runner definition !define TEST_RUNNER {FitSharp\Runner.exe} on your page, change it to !define TEST_RUNNER {FitSharp\RunnerW.exe}. Then, when you run your test, a Windows Form will pop up, waiting for you to click the "Go" button. Don't click the Go button just yet. In Visual Studio attach to process "RunnerW.exe" then click the Go button. Execution should break at any breakpoints you have in Visual Studio.Graz
H
5

Another good way is to simply introduce a assertion that launches the debugger. In our code all of our fixtures derive from some simple custom base fixtures with some utilities in them like |debug|

this assertion just launches the debugger like so:

 public void Debug()
    {
        System.Diagnostics.Debugger.Launch();
    }

as soon as the assertion is hit the debugger launches.

this has the advantage in that you can quickly pop it in wherever you like. Sometimes you might have a long test that uses the same assertions over and over, in which case this is nice because you can do it right before the one that's the problem.

Hendrick answered 10/7, 2010 at 17:21 Comment(0)
S
0

I created a simple utility that calls Debbuger.Launch without needing to change the code or the FitNesse script. This is very useful if your code and fitnesse scripts reside in source-control. See this blog post for more details.

Splenetic answered 5/7, 2011 at 12:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.