Visual Studio does not debug when debugging unit tests?
Asked Answered
S

4

10

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.

Swordplay answered 19/12, 2011 at 18:42 Comment(1)
Related post - Visual Studio 15.8.1 not running MS unit testsAfford
N
0

Highly recommend Test Driven, you'll be able to right click a test and choose test with debugger and step through code very easily.

Nitrification answered 19/12, 2011 at 18:47 Comment(2)
yes i download before i post the question and i right click and test with debugger but never stop at the breakpoint.Swordplay
make sure your breaking point is right at the opening of your test (first line) and make sure the test is not failing at the setup of your test for some reason.. if you have a setup put your break point there, so that you are absolutely positive that it's just not reaching your break pointNitrification
B
8

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

Bestraddle answered 19/12, 2011 at 18:45 Comment(1)
yes i am doing test and run with debugger but still does not work... so i am looking at the link in your post and it says Go to Debug->Exceptions or ctlr-alt-e. Then you can make sure the exception you want to catch is enabled. after i go to debug==>>exeception>> what should i select?Swordplay
I
3

I had the same problem and solved it this way:

  • right click on your test project
  • go to properties
  • open the "build" tab
  • uncheck "Optimize code" checkbox
Incalescent answered 26/7, 2017 at 20:51 Comment(0)
N
0

Highly recommend Test Driven, you'll be able to right click a test and choose test with debugger and step through code very easily.

Nitrification answered 19/12, 2011 at 18:47 Comment(2)
yes i download before i post the question and i right click and test with debugger but never stop at the breakpoint.Swordplay
make sure your breaking point is right at the opening of your test (first line) and make sure the test is not failing at the setup of your test for some reason.. if you have a setup put your break point there, so that you are absolutely positive that it's just not reaching your break pointNitrification
S
0

The same problem happened to me in Visual Studio 2015. The problem was that the Solutions Configuration drop-down in Visual Studio's toolbar was not set to Debug. After making this change, debugging worked.

Sapsago answered 24/1, 2019 at 19:49 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.