如何使用 vs.net 2008 和 nunit 进行调试? [英] How to debug with vs.net 2008 and nunit?
问题描述
我正在使用 nunit runner 运行 vs.net 2008.
I am running vs.net 2008 with nunit runner.
如果我在单元测试代码中设置断点,它只会在运行器中运行单元测试.
If I set a breakpoint in the unit test code, it just runs the unit test in the runner.
我猜我必须以某种方式将 nunit 与 vs.net 集成?
I'm guessing I have to integrate nunit with vs.net somehow?
我的单元测试只是一个类库项目,我无法在 vs.net 2008 中运行测试,我目前只能通过运行器来运行.
My unit tests are just a class library project, I cannot run the tests in vs.net 2008, I can only do it via the runner currently.
推荐答案
如果您想在当前设置中进行调试(运行已加载程序集的 nunit runner),请执行以下操作:
If you want to debug in your current setup (running nunit runner that has your assemblies loaded), do the following:
- 运行 nunit.exe
- 打开(或创建)您的 nunit 项目(文件 > 新建/打开项目
- 在工具">设置"下,单击IDE 支持">Visual Studio"并选中启用 Visual Studio 支持"
- 一旦您的 nunit 文件设置好并准备好运行,请转到 VS 并单击工具 > 附加到进程...
- 确认在附加到"区域中选择了托管代码"
- 找到 unit.exe,选择它,然后点击附加
- 在库中放置所需的断点
- 从 nunit GUI,单击运行
- 如果您正在调试正确的程序集,它应该会到达您的断点.
理想情况下,我会将其更改为将 nunit 作为外部程序运行并提供您的 .nunit 项目文件作为输入.请参阅此处了解更多详情.
Ideally, I would change it to run nunit as an external program and supply your .nunit project file as the input. See here for more details.
这篇关于如何使用 vs.net 2008 和 nunit 进行调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!