问题
Using the sample project from MSDN, I'm writing a custom unit test adapter. I'm able to debug it with the experimental instance in visual studio, set breakpoints, and see System.Diagnostics.Trace.WriteLine() output, and it all works beautifully for almost all of my methods. I can see evidence that it's working (as in the outputs of the test cases are what I expect if I fiddle with the error message, duration, etc).
However, for the methods in my test executor class (deriving from Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.ITestExecutor), I neither hit my breakpoints nor see any of my trace output. Is there a setting or something to make that work? I'm wondering if the test execution framework is doing some kind of optimization on this class that makes it harder to debug.
Thank you.
回答1:
You have to attach the debugger to the process vstest.executionengine.x86.exe, which is a child spawned by devenv.exe. I'm assuming the same trick applies to vstest.discoveryengine.x86.exe for the test discovery code.
Bonus Question: Is there a way to set up the debugger to attach to those automatically when I debug my unit test adapter project?
来源:https://stackoverflow.com/questions/24811460/can-i-not-debug-the-itestexecutor-methods-in-a-unit-test-adapter