I have a console application and I added a class library solution to the project to hold all my unit tests.
All is working fine apart from the fact that breakpoints do not get hit when I run my tests.
If I run the whole application, breakpoints on the console app get hit fine.
If I run the tests, breakpoints in the test classes and the console app are completely ignored.
I saw another post saying to go to debug > start new instance, but as it is a class library I cannot do this. Should I have test classes in a different project type?
I am using Nunit, VS2012 and the NUnit runners.
I have a couple of tests failing and I cant figure out why, I really need to be able to step through the code.
Any help is greatly appreciated.
If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.
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.
To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
Instead of running your tests, try debugging your tests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With