1. In Visual Studio, right click on the NUnit Test project, select the Properties option.
2. Go to the Debug tab, select the ‘Start External Program’ radio button. Browse to packages\NUnit.Runners.2.6.2\tools\nunit.exe
3. In the ‘Command line arguments’ enter the test DLL (example — XYZ.ABC.Tests.dll). Don’t forget the .dll
4. Make the test project as startup project by right-clicking on the project in the Solution Explorer and selecting Set as Startup Project.
Hit F5 to launch NUnit, select and run the appropriate test method to be debugged, and enjoy the debugging goodness.
Note — Due to NUnit versions and .net versions incompatibilities, you may still not be able to debug. In that case, go to packages\NUnit.Runners.2.6.2\tools and find nunit.exe.config and edit the startup to be
<startup useLegacyV2RuntimeActivationPolicy=“true”>
<!– Comment out the next line to force use of .NET 4.0 –>
<requiredRuntime version=“4.0.30319” />
</startup>
and
edit nunit-agent.exe.config’s <startup> to be
<startup useLegacyV2RuntimeActivationPolicy=“false”>
<supportedRuntime version=“v4.0.30319” />
</startup>