简体   繁体   English

通过NUnit GUI 0.60运行测试时如何使Visual Studio 2017达到断点?

[英]How to make Visual Studio 2017 hit breakpoints when running tests through NUnit GUI 0.60?

I'm attempting to debug an NUnit 3 test from Visual Studio 2017 by using Project Properties -> Debug -> Start External Program = <path to nunit-gui.exe> . 我试图通过使用Project Properties -> Debug -> Start External Program = <path to nunit-gui.exe>从Visual Studio 2017调试NUnit 3测试。 I can just use the NUnit Test runner from within Visual Studio--that works fine. 我只能在Visual Studio中使用NUnit Test运行器-效果很好。 I can also run NUnit GUI first, load the DLL, and then attach to the nunit-agent-x86.exe process and the breakpoints work. 我也可以先运行NUnit GUI,加载DLL,然后附加到nunit-agent-x86.exe进程,然后断点开始工作。 However, I'd like to just be able to click the "Start" button from within visual Studio without going through those extra steps. 但是,我只想从Visual Studio中单击“开始”按钮,而无需执行这些额外步骤。

NUnit GUI does start and I'm able to run the test. NUnit GUI确实启动,并且我可以运行测试。 However, when I set breakpoints in Visual Studio, they don't get hit (mousing over the breakpoint yields a popover with the message, "The breakpoint will not currently be hit. No symbols have been loaded for this document."). 但是,当我在Visual Studio中设置断点时,它们不会被击中(将鼠标悬停在该断点上会弹出消息,消息为“当前不会命中该断点。尚未为此文档加载任何符号。”)。 In the past, under NUnit 2.6, I fixed this by modifying the nunit-gui.exe.config : 过去,在NUnit 2.6下,我通过修改nunit-gui.exe.config来解决此nunit-gui.exe.config

<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319" />
<!-- <supportedRuntime version="v2.0.50727" /> -->
</startup>

However, this still doesn't seem to fix the breakpoint issue in NUnit GUI 0.60 . 但是,这似乎仍不能解决NUnit GUI 0.60中的断点问题。

My test assembly platform target is x86 (due to x86 dependencies). 我的测试组装平台目标是x86(由于存在x86依赖性)。 I'm running my test on Windows 10 64-bit. 我正在Windows 10 64位上运行测试。

In VS2017: 在VS2017中:

  1. In the top menu open the Test Explorer window via Test > Windows > Test Explorer. 在顶部菜单中,通过测试> Windows>测试资源管理器打开“测试资源管理器”窗口。
  2. Rebuild the solution. 重建解决方案。
  3. Set a breakpoint in the test you want to debug 在要调试的测试中设置断点
  4. Left click on the "blue diamond" icon between [Test] and the public void method definition. 左键单击[Test]public void方法定义之间的“蓝色菱形”图标。
  5. Left click Debug. 左键单击调试。

暂无
暂无

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

相关问题 当测试类从实现NHibernate的类继承时,Visual Studio 2017未发现NUnit测试 - Visual Studio 2017 not discovering NUnit tests when tests class inherits from a class that implements NHibernate NUnit扩展无法通过NUnit GUI运行测试 - NUnit extension does not work running tests through the NUnit GUI 如何使Visual Studio将异常抛入NUnit gui? - How to make Visual Studio throw exceptions into the NUnit gui? 从Visual Studio 2015运行nunit测试 - running nunit tests from visual studio 2015 使用 Visual Studio 2017 的 specflow + nunit3 中未显示测试 - The tests are not shown in specflow + nunit3 with Visual Studio 2017 如何在仍然引用 NUnit 的同时使我的 Visual Studio 2017 项目不是测试项目 - How can I make my visual studio 2017 project NOT a test project while still referencing NUnit 在终结器中抛出异常时,Visual Studio 测试资源管理器未完成运行 NUnit 测试 - Visual Studio Test Explorer doesn't finish running NUnit tests when exception in finalizer is thrown Visual Studio 未命中应始终命中的断点 + 在运行代码中绑定断点的问题 - Visual Studio not hitting breakpoints that should always be hit + problems binding breakpoints in running code NUnit - 在 Visual Studio 中使用测试适配器运行测试时获取结果 xml - NUnit - Getting results.xml when running tests with Test Adapter in Visual Studio 在Visual Studio 2010中使用代码覆盖率运行NUnit测试 - Running NUnit tests in Visual Studio 2010 with code coverage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM