开发者

Provide the ability to debug a .Net executable from within an unit test

I have a win forms application that I would like to be able to debug during the running of my unit testing and am having a mental block as to how to achieve this. Due to architectural decisions beyond my control, I am unable to re factor this product into manageable components that can be unit tested, so these are technically integration tests being performed in visual studio. That being said, I will try to explain my scenario best that I can.

The win form client (the one I want to debug) connects to various endpoints of an asp.net website using classic wsdl for services. In the VS solution all the various projects are added, Client, Website, and Tests (simplified project list for brevity), During development, the server and client sp开发者_如何学Pythonin-up at one after another by selecting multiple startup projects in the solution properties. Doing this gives me the ability to debug both, and seems like a standard approach to development in VS 2010/2008.

When the time comes to TEST the client (MSTest), I spin-up the server using Microsoft.VisualStudio.WebHost (this gives me the ability to run in-process and to debug). What's missing, and the point of this post is "How do I now start the client in-process with the debugging facilities enabled?". Starting a new process with system.diagnostics does not work, nor does White's Application object (http://white.codeplex.com/)

Any pointer or tips would be much appreciated.

Regards, Stephen


Instead of launching your executable, launch vsjitdebugger.exe and pass your executable as a parameter. This would launch your app under the registered JIT debugger. On machines with VS installed should be VS itself (provided you actually went in the Options and registered it).

(On machines without VS, I think the registered JIT debugger is Watson, but I might be wrong on this one)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜