使用 TestContext.WriteLine 重复输出
我在 VS 2008 中做了一个“有序测试”,它执行了 4 个测试。它运行的 TestMethod 测试之一有几个 writeline 语句,如下所示:
TestContext.WriteLine("One");
TestContext.WriteLine("Two");
TestContext.WriteLine("Three");
我在结果的“附加信息”中收到的输出显示了以下输出:
一
二
三
一
二
一
二
我不认为测试方法运行了多次。我认为 writeline 输出只是以某种奇怪的方式进行缓冲。 如何解决此问题?
对于任何具有 TestContext
writeline 语句的测试方法(至少在从有序测试调用时),我都会遇到此问题。
I've made an "ordered test" in VS 2008 which executes 4 tests. One of the TestMethod
tests it runs has several writeline statements, like this:
TestContext.WriteLine("One");
TestContext.WriteLine("Two");
TestContext.WriteLine("Three");
The output I receive in the "Additional Information" of the results shows this output:
One
Two
Three
One
Two
One
Two
I don't think the test method is running multiple times. I think the writeline output is simply being buffered in some bizarre way. How do I fix this?
I get this problem with any test method that has TestContext
writeline statements (at least when invoked from an ordered test).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论