问题描述
我刚刚从NUnit 2.5.2升级到了NUnit 2.5.7,以便我可以使用.Net Framework 4构建的DLL来运行单元测试。我一直在使用2.5.2很长一段时间项目属性下的StartExternalProgram属性。在这种情况下,我从来没有必须显式调试附加到NUnit进程。
现在2.5.7以下似乎必须明确附加到NUnit_Agent进程,以便调试正在测试的代码。
当然这意味着,我不需要两次单击来运行我的单元测试,现在我必须单击VS2010中的Debug.Run图标,等待NUnit GUI出现,alt-Tab返回到VS2010,单击Debug.Attach ..,向下滚动列表以找到NUnit Agent,双击选择它,alt-Tab返回到NUnit GUI,单击运行以运行测试。
那么,有没有理由使用NUnit在2.5.7或更糟的情况下变得更加困难?
提前感谢任何有关恢复的建议
问题是NUnit正在启动一个子进程(nunit-agent)。 exe。)我可以通过打开nunit.exe.config并添加以下部分来解决这个问题:
< startup> ;
< supportedRuntime version =v4.0.30319/>
< / startup>
编辑:如果您仍然希望在.Net 2.0中使用nunit,请确保将该版本添加为好。我的配置最终看起来像这样:
< startup>
< supportedRuntime version =v2.0.50727/>
< supportedRuntime version =v4.0.30319/>
< / startup>
编辑2:我最近也发现条目的顺序也有所不同。 >
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.
这篇关于NUnit 2.5.7需要在VS2010下显式调试附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!