VSTest.Console on startup with / Logger: Console does not print debug output from test method

I am using Visual Studio 2015. I am trying to print some assertions just to track down a very long test. When using VSTest.Console with / Logger: trx debug output (regardless of whether we use Console.WriteLine (), Debug.Writeline () or Trace.WriteLine ()), go to the trx file that is generated. However, when run with / Logger: Console, the custom debug output is not displayed in the console output: only the test result appears. I even wrote 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/

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

I think the extension might indeed be redundant here and I can use the console log that comes with Visual Studio Extensions. Perhaps I need to make a special call to send an informational message, or use the correct command line switch.

I am using the following command right now:

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

      

The test passes, but only outputs the following result:

Running test execution, please wait ... Passed TestMethod1

Total tests: 1. Completed: 1. Error: 0. Skipped: 0. Successful test execution. Test execution time: 3.3929 seconds

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

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

      

I am wondering if it is possible to show the same information as well when using the console logger.

+3


source to share


1 answer


The behavior has now been changed in VS 2017 15.5.2+, it now produces the result.



+2


source







All Articles