简体   繁体   English

NUnit 2.5.7要求在VS2010下显式调试附件

[英]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. 我刚刚从NUnit 2.5.2“升级”到NUnit 2.5.7,这样我就可以针对用.Net Framework 4构建的DLL运行单元测试。我通过“StartExternalProgram”长时间使用2.5.2 “项目属性下的财产。 I've never had to explicitly debug attach to the NUnit process in that scenario. 在那种情况下,我从来没有必要显式调试附加到NUnit进程。

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. 现在在2.5.7下,似乎必须显式附加到NUnit_Agent进程才能调试被测代码。

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). 当然这意味着我不需要两次点击来运行我的单元测试,而是现在必须在VS2010中单击Debug.Run图标,等待NUnit GUI出现,alt-Tab返回VS2010,单击Debug.Attach ..,向下滚动找到NUnit Agent的列表,双击选择它,alt-Tab返回NUnit GUI,单击Run运行测试。

So, is there a reason that using NUnit has become that much more difficult under 2.5.7 or did a ball get dropped? 那么,是否有理由在2.5.7下使用NUnit变得更加困难或者球被丢弃了?

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: 问题是NUnit正在启动一个子进程(nunit-agent.exe。)我能够通过打开nunit.exe.config并添加以下部分来解决这个问题:

<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. 编辑:如果您仍想将nunit与.Net 2.0一起使用,请确保同时添加该版本。 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. 编辑2:我最近也发现条目的顺序也有所不同。

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. 也许不是你问题的答案,而是另一种看待它的方式:Resharper包含一个在VS2010 gui中运行nunit测试的组件,无需任何单独配置的外部程序。 This might simplify things for you? 这可能会为你简化一些事情?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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