Search code examples
debuggingexceptionnunitbreakpoints

Debugging with NUnit


I'm using NUnit for my unit tests and I have my unit test class library project setup so that Visual Studio launches the NUnit gui when I press F5. This lets me set breakpoints in my tests and look at the contents of variables, etc.

What isn't happening though is that if one of my tests crashes (throws an exception) Visual Studio does not automatically break on the line that caused the exception. The NUnit gui just shows that the test failed.

Since I'm using my tests to debug my code I would really like to break on exceptions as that would make things so much easier; especially when the code is in a loop and I can't easily use conditional breakpoints.

Is this just a simple setting that I'm missing?


Solution

  • Debug->Exceptions. Check "Thrown" for the class of exceptions that you want to break on (likely "Common Language Runtime Exceptions").