Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 Unit Test client and service debug

Dumb question but for some reason I just can't seem to figure out how to debug a unit test, hit a breakpoint on the client and step into a web service. In VS 2010 I just set my solution to be a Multiple Startup Projeects and set the debug to the client UI test and also the web service. When my breakpoint hit in the UI test I could step into the web service. In VS 2012, I don't see a way to do that. Can anyone help?

like image 420
hobeau Avatar asked Oct 04 '22 17:10

hobeau


1 Answers

  1. Start the website without debugging (if it's not already running).
  2. Put a breakpoint in your unit test.
  3. Start your unit test.
  4. When the breakpoint is hit, use Debug > Attach to Process to attach to iisexpress.exe.

The official instructions are wrong. They say to attach the debugger first, but if you do that, the commands to start your unit test are disabled.

Always having to manually attach can be a pain. There doesn't seem to be a way to do it quickly from the Command Window. If I had to do a lot of debug cycles, I'd temporarily copy the test code into the web application somewhere that would get run at startup.

like image 121
Edward Brey Avatar answered Oct 10 '22 03:10

Edward Brey