运行测试时 Debug.WriteLine() 发生两次

发布于 2024-07-10 20:39:42 字数 198 浏览 7 评论 0原文

我在 VS2008 运行单元测试时遇到一个奇怪的问题。 当我使用 Resharper 或 TestDriven 在正常或调试模式下运行单元测试时,Debug.WriteLine("foo") 行将执行两次:即。 在VS的输出窗口中我可以看到每行都写了两次。

然而,如果我逐步完成测试,每行似乎都会按预期执行一次。 有人知道这是怎么回事吗? 谢谢!

I have an odd problem in VS2008 running unit tests. When I run the unit test using either Resharper or TestDriven, in either normal or Debug mode, the Debug.WriteLine("foo") lines are being carried out twice: ie. in the Output window of VS I can see each line written twice.

If I step through the test, however, each line seems to be carried out once as expected. Anyone know what is going on here? Thanks!

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

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

发布评论

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

评论(1

木落 2024-07-17 20:39:42

IIRC Studio 的输出窗口不仅显示 STDOUT 和 STDERR,还显示跟踪消息。 适当的测试运行程序可能会在写入 STDOUT 之外设置跟踪,如果您手动进入测试,则不会发生这种情况。

IIRC the Studio's Output window displays not only STDOUT and STDERR but also trace messages. A proper test runner might set up a tracing additionally to writing to STDOUT, something which doesn't happen if you step into the test manually.

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