- Debugging Your NUnit Tests
- Extending the Sample
- Debugging Your NUnit Tests
- More On Nant
- Step-by-Step Build
- Conclusion
Debugging Your NUnit Tests
Setting up VS.NET to debug your unit tests is very simple; just follow these steps:
Right-click on the NUnit test project (MusicTest, in my case) and select Properties.
Select Debugging under the Configuration Properties group
Enter nunit-gui.exe in the Start external program.
Figure 2 illustrates setting the debug properties for your project.
Figure 2 Setting Visual Studio.NET to run the NUnit GUI application while debugging.
NOTE
Your startup project must be set to your NUnit test library for debugging with NUnit to work.
You can now set breakpoints and watches as you normally would. Pressing F5 (Run) launches nunit-gui.exe, and breaks your program on either error or breakpoint. Figure 3 shows my NUnit test halting on a breakpoint.
Figure 3 Running an NUnit test with Setting Visual Studio.NET.
You can now write, run, and debug your NUnit tests. This ability will prove to be invaluable as you start to learn NUnit.