Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 219
Edward Wilde Avatar asked Jun 25 '10 10:06

Edward Wilde


People also ask

How do I enable debugging in Visual Studio?

In the Visual Studio toolbar, make sure the configuration is set to Debug. To start debugging, select the profile name in the toolbar, such as <project profile name>, IIS Express, or <IIS profile name> in the toolbar, select Start Debugging from the Debug menu, or press F5.


2 Answers

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

like image 71
Mike Stockdale Avatar answered Nov 04 '22 08:11

Mike Stockdale


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.

like image 45
ryber Avatar answered Nov 04 '22 06:11

ryber