MS测试->为什么我不能使用断点进行调试?

发布于 2024-09-26 21:00:21 字数 61 浏览 0 评论 0原文

我设置断点,然后在 Visual Studio 中运行“运行测试”。为什么 MSTest 不运行到我的断点?

I setup breakpoints, then run "Run Tests" in Visual Studio. Why don't MSTest run to my breakpoints?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

半寸时光 2024-10-03 21:00:21

选择调试 -> 当前上下文中的测试(或其他)

Choose Debug -> Tests In Current Context (or otherwise)

南汐寒笙箫 2024-10-03 21:00:21

对于 Visual Studio 2012 Express,我选择:

TEST -> 调试 -> 所有测试

For Visual Studio 2012 Express, I chose:

TEST -> Debug -> All Tests

酷遇一生 2024-10-03 21:00:21

当通过启动外部程序使用MSTest时,“mstest”指定/noisolation选项。

When using MSTest via Start external program "mstest" specify the /noisolation option.

メ斷腸人バ 2024-10-03 21:00:21

升级到 MSTest V2。我引用了新的 nuget 包,删除了现有的 MSTest 引用,但没有调试。我阅读 我不应该再使用测试设置文件,所以我删除了它;没有喜悦。我终于发现清除我的临时目录可以解决问题。

I had this problem after upgrading to MSTest V2. I referenced the new nuget packages, removed the existing MSTest reference, but no debugging. I read that I should no longer be using a test settings file, so I removed that; no joy. I finally discovered that clearing out my temp dir did the trick.

画尸师 2024-10-03 21:00:21

就我而言,我选择了发布版本。当我切换到调试时,我的断点被命中。

In my case it was that I had selected Release build. When I switched to Debug then my breakpoint was hit.

等往事风中吹 2024-10-03 21:00:21

视觉工作室 2022
使用 msTest,选项:

  1. 当您在测试方法中时按 Ctrl + r、Ctrl + t 调试当前测试方法。
  2. 转到菜单测试>调试上次运行
  3. 转到菜单“测试”>“调试”调试所有测试
  4. 转到菜单“测试”>测试资源管理器,当窗口测试资源管理器打开时,右键单击您想要的测试方法>调试

问题在于您“运行”测试,但您必须“调试”测试,以便可以利用断点。

干杯。

有关 的参考在 Visual Studio 中测试

Visual Studio 2022
with msTest, options:

  1. When you are in test method press Ctrl + r, Ctrl + t to debug the current test method.
  2. Go to menu test > debug last run
  3. Go to menu Test > debug all test
  4. Go to menu Test > Test Explorer, when the window test explorer open, right clic over the test method you want > Debug

the problem is that you "run" the test, but you must "debug" the test so you can make use of break points.

cheers.

Reference about Testing in visual studio

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文