简体   繁体   中英

NUnit 2.5.7 requires explicit Debug Attach under VS2010

I've just "upgraded" from NUnit 2.5.2 to NUnit 2.5.7 so that I can run unit tests against an DLL's built with .Net Framework 4. I've been using 2.5.2 for a long time via the "StartExternalProgram" property under project properties. I've never had to explicitly debug attach to the NUnit process in that scenario.

Now under 2.5.7 it appears that one must explicitly attach to the NUnit_Agent process in order to debug the code under test.

Of course this means that instead of requiring two clicks to run my unit tests I now have to click Debug.Run icon in VS2010, wait for NUnit GUI to appear, alt-Tab back to VS2010, click Debug.Attach.., scroll down the list to find NUnit Agent, double click to select it, alt-Tab back to NUnit GUI, click Run to run the test(s).

So, is there a reason that using NUnit has become that much more difficult under 2.5.7 or did a ball get dropped?

Thanks in advance for any advice on restoring the "automagic attach" from earlier versions.

The problem is that NUnit is kicking off a child process (nunit-agent.exe.) I was able to fix this by opening up nunit.exe.config and adding the following section:

<startup>
    <supportedRuntime version="v4.0.30319" />
</startup>

Edit: If you still want to use nunit with .Net 2.0, make sure to add that version as well. My config ended up looking like this:

<startup>
    <supportedRuntime version="v2.0.50727" />
    <supportedRuntime version="v4.0.30319" />
</startup>

Edit 2: I also recently found that the order of the entries also makes a difference.

Perhaps not quite an answer to your problem, but a different way of looking at it: Resharper includes a component that runs nunit tests within the VS2010 gui without needing any separately configured external programs. This might simplify things for you?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM