与/ Logger一起运行时VSTest.Console:控制台不会打印测试方法的调试输出 [英] VSTest.Console when run with /Logger:Console does not print debug output from test method

查看:123
本文介绍了与/ Logger一起运行时VSTest.Console:控制台不会打印测试方法的调试输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio2015。
我正在尝试打印一些语句以跟踪长期运行的测试。当将VSTest.Console与/ Logger:trx一起使用时,调试输出(无论我们使用Console.WriteLine(),Debug.Writeline()还是Trace.WriteLine())都会进入生成的trx文件。但是,当使用/ Logger:Console运行时,自定义调试输出不会显示在控制台输出上:仅显示测试结果。我什至通过引用来写了自己的扩展名:

I am using Visual Studio 2015. I am trying to print some statements just for tracking a very long running test. When using VSTest.Console with /Logger:trx the debug output (whether we use Console.WriteLine(), Debug.Writeline() or Trace.WriteLine()) does go into the trx file which gets generated. However, when run with /Logger:Console the custom debug output does not show on the console output: only the test result shows up. I have even written my own extension by referring to:

https://blogs.msdn.microsoft.com/vikramagrawal/2012/07/26/writing- loggers-for-command-line-test-runner-vstest-console-exe /

但是,目前尚不清楚如何从内部发送TestMessage一个测试,以便调用TestMessageHandler并输出输出。

However, it is not clear how to send a TestMessage from inside a test so that the TestMessageHandler gets called and output gets printed.

我认为扩展实际上在这里可能是多余的,我也许可以使用控制台记录器Visual Studio扩展的一部分。也许我需要拨打特定电话以发送参考消息,或者需要使用适当的命令行开关。

I think an extension may actually be redundant here and I may be able to use the console logger which comes as part of Visual Studio Extensions. Perhaps I need to make a specific call to send the informational message, or need to use a proper command line switch.

我现在正在使用以下命令:

Vstest.Console.exe <Test dll> /logger:Console

测试正在运行,但仅产生以下输出:

开始执行测试,请稍候...
通过TestMethod1

Starting test execution, please wait... Passed TestMethod1

总测试次数:1。通过:1.失败:0。跳过:0。
测试运行成功。
测试执行时间:3.3929秒

Total tests: 1. Passed: 1. Failed: 0. Skipped: 0. Test Run Successful. Test execution time: 3.3929 Seconds

而trx文件在输出部分下有以下部分,其中包括console.writeline()和debug.trace ()输出:
(下面显示的文本仅出于示例目的)

Whereas the trx file has following sections under output section which includes the console.writeline() and debug.trace() outputs: (The text being shown below is just for the sake of example)

<Output>
    <StdOut>
    Test Started
    Test Ended
    Debug Trace:
    Test started
    Test ended
    </StdOut>
</Output>

我想知道使用Console logger时是否也可能显示相同的信息。 / p>

I am wondering if it might also be possible to show the same information when using the Console logger.

推荐答案

行为现在在VS 2017 15.5.2+中已更改,现在会发出输出。

The behavior is now changed in VS 2017 15.5.2+, it now emits the output.

这篇关于与/ Logger一起运行时VSTest.Console:控制台不会打印测试方法的调试输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆