Freigeben über


How to enable MSTest logs

Here are the steps which you should perform to enable mstest logs.

1. Go to your mstest installation directory via an administrator command prompt. (typically the installation directory is something like C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\).

2. Open the mstest configuration file (mstest.exe.config) and add a snippet similar to the one shown below under the configuration node. Make sure that the path you have specified exists and you have appropriate permissions for it.

<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\temp\MSTest.log" />
</listeners>
</trace>
<switches>
<!-- You must use integral values for "value". Use 0 for off, 1 for error, 2 for warn, 3 for info, and 4 for verbose. -->
<add name="EqtTraceLevel" value="4" />
</switches>
</system.diagnostics>

</configuration>

3. Save the configuration file and try running a test.

After this a log file at the above mentioned path should get generated.

Comments

  • Anonymous
    August 28, 2013
    Is there any way to configure the file to rollover?

  • Anonymous
    January 20, 2016
    I have Visual Studio 2015 and I tried editing the config file and doesne't seem to generate output.

  • Anonymous
    January 20, 2016
    @Dilshod: How are you running tests? VS? vstest.console.exe? or mstest.exe?

  • Abhitej.