Visual Studio Test Explorer Error Logs

2019-07-12 11:44发布

问题:

I've been attempting to fix a problem I have with Test Explorer not showing tests when I'm in a different configuration environment. I make local environment changes by updating my app.config.

I have already tried a few steps found here and in other sites including cleaning my project, updating to the latest xUnit test runner, etc.

I am sure the reason is code/project based and not the Visual Studio environment itself. What I would like to know is whether or not there is a log file I can look at that would help me to determine why my tests are not showing. Or, is there another good method to troubleshoot errors with tests not showing up in Test Explorer?

回答1:

There is a MSDN Blog post about this.

Essentially, you need to:

  1. Go to folder %VSInstallDir%\Common7\IDE\CommonExtensions\Microsoft\TestWindow
  2. Find the config file for the process you want to debug (e.g. vstest.console.exe.config, vstest.discoveryengine.exe.config, etc)
  3. Alter the config file system.diagnostics node to include:

    <system.diagnostics> 
        <switches> 
            <add name="TpTraceLevel" value="4" /> 
        </switches> 
    </system.diagnostics>
    
  4. Close VisualStudio, open it again, and discover/run tests from TestExplorer Window
  5. Look for logs under %temp%[processname].TpTrace.log (e.g. vstest.console.tptrace.log)