Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio does not debug when debugging unit tests?

I have bunch of unit test I'm testing and I put the breakpoint on the unitest code and when I run with CTL+R,T instead of stopping on the breakpoint it just execute the code and I'm trying to debug the unittest code because its failing. Any help?

I'm using VS 2010 professional version.

like image 515
Nick Kahn Avatar asked Dec 19 '11 18:12

Nick Kahn


People also ask

How do I Debug a unit test in Visual Studio?

To start debugging: In the Visual Studio editor, set a breakpoint in one or more test methods that you want to debug. Because test methods can run in any order, set breakpoints in all the test methods that you want to debug. In Test Explorer, select the test method(s) and then choose Debug on the right-click menu.

Can you Debug a unit test code?

Debug and analyze unit tests with Test ExplorerYou can use Test Explorer to start a debugging session for your tests. Stepping through your code with the Visual Studio debugger seamlessly takes you back and forth between the unit tests and the project under test.

Why are my breakpoints not working?

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.

How do I run a JUnit test case in debug mode?

In the case of a test failure you can follow these steps to debug it: Double click the failure entry from the Failures tab in the JUnit view to open the corresponding file in the editor. Set a breakpoint at the beginning of the test method. Select the test case and execute Debug As>JUnit Test from the Debug drop down.


1 Answers

Visual Studio 2010 test not entering debugger on exception

Make sure you are doing "Test->Debug" or "Debug test"/"Debug selected test". Just running tests with configuration set to Debug will not attach debugger to the running test.

'Hope that helps

like image 89
paulsm4 Avatar answered Sep 19 '22 03:09

paulsm4