NUnit: Debugging Test Code

Debugging Unit Tests Using TestDriven.NET

  • Download and install TestDriven.NET Visual Studio add-in. This can be downloaded from TestDriven.NET website.
  • Open the solution in Visual Studio.
  • Right click on the test class and select the "Test with Debugger" option.

Debugging Unit Tests Using the Visual Studio Debugger

  • Set the testing project as the startup project in the Visual Studio solution. Right click on the project and select "Set as StartUp Project" option.
  • Open the project properties of the project, and select Debug option.
  • Set the "Start Action" to "Start external program" and select the nunit.exe.
  • Place a breakpoint anywhere in the test code that will be tested.
  • Run the application in debug mode (Press F5 Key)
  • The NUnit application should open.
  • Run the tests you want to debug and let the debugger stop at the relevant breakpoint.