How to enable UTE logs?
Unit test explorer has bunch of processes (client-process, discovery/datacollection process, execution process) and depending upon what you want to debug, you should select the appropriate process and enable its logs. Once you have enabled the logs, the logs will get generated in %Temp% folder with log file names of the format <ProcessName>.TpTrace like vstest.executionengine.TpTrace.log Here are the steps to enable log for a given process: -
- Open the configuration file of the process like (vstest.executionengine.exe.config)
- Change the TpTraceLevel from 0 to 4.
<system.diagnostics>
<switches>
<add name="TpTraceLevel" value="0" />
</switches>
</system.diagnostics>
Note: - This xml does not exist in devenv.exe.config, so if you want to enable logs of visual studio, you should copy the above xml with TpTraceLevel as 4 and put it in devenv.exe.config.
- Save the configuration file.
- Restart your client so that the configuration file gets applied.
- Do a discovery or a test run and now you will observe the logs in %temp% folder.
Note:
- Discovery/datacollection happens in vstest.discoveryengine* process and execution happens in vstest.executionengine* process when done from VS (out of process mode). For command-line by default discovery/execution happens in the same process (vstest.console.exe)
- The UTE binaries (like vstest.console.exe, vstest.executionengine*.exe… ) are installed typically in %VSInstallDir%\Common7\IDE\CommonExtensions\Microsoft\TestWindow folder.
Comments
- Anonymous
April 19, 2012
Aseem,I changed the value from 0 to 4 and also placed that XML in devenv.exe.config. Restarted VS 11 Ultimate Beta and then tried the Run All in Unit Test Explorer. I got the same error and when I went to check the %Temp% folder there were no logs there. I restarted Windows 7 and even after that nothing got generated.I tried to find any files with TpTrace in Windows Explorer and nothing appeared...What's the problem?Leniel - Anonymous
April 19, 2012
The comment has been removed - Anonymous
April 20, 2012
The comment has been removed - Anonymous
April 21, 2012
The comment has been removed - Anonymous
April 21, 2012
The comment has been removed - Anonymous
April 21, 2012
Aseem,1 - Yes, it's present.2 - Yes, it's present.3 - Yes, it's also in C:Program FilesMicrosoft SDKsWindowsv8.0ExtensionSDKsTestPlatform11.0RedistCommonConfigurationneutralSee the screenshots: http://imgur.com/a/ULpVzLeniel - Anonymous
April 21, 2012
The comment has been removed - Anonymous
April 22, 2012
Aseem,The intriguing thing is that it's an intermittent problem. If I restart VS 11 Beta 10 times, Unit Test Explorer will work only once. :o) 9 times it'll show the error: "Unexpected error detected. Check the Tests Output Pane for details." and no test gets discovered...1 - Yes, the test works as expected as can be seen here: gist.github.com/24685872 - See this screenshot: http://imgur.com/xuJyB3 - Yes, it was a upgrade!4 - I have no idea... I had VS 2010 installed side by side with VS 11 Beta. Decided to uninstall it because I use VS 11 Beta only... I also had VS 11 Express for Web and then uninstalled it keeping only VS 11 Ultimate.5 - I have no other machine at hand.6 - Sure. Just tell me when...Regards,Leniel - Anonymous
April 22, 2012
Leniel,From #2, it is clear that the Microsoft.VisualStudio.TestPlatform.Core.dll is getting loaded from %appData%assemblydl3.... path which is causing this problem. And on searching the web for who can be copying the binary, I found the below link which seem to indicate that shadow copy is causing the problem.stackoverflow.com/.../what-is-cache-appdata-local-assembly-dl3Do you know why shadow copy would be enabled for VS binaries? Do you have any extension installed on your machine? Can you please try running VS in safe mode and see whether things work or not?Meanwhile I have filed a bug in our internal system to improve the resolution logic so that no one else faces the same problem as you are facing.RegardsAseem Bansal - Anonymous
April 25, 2012
Aseem,I have no idea about why shadow copy is enabled...These are the extensions installed in VS 11 Ultimate Beta: http://imgur.com/7Ave2When running VS in /SafeMode => Unit Test Explorer is dead after building the Test project (it's window is blank/have no content).The good thing is that you identified where the problem lies! :DKeep up the great work... VS 11 rocks. :)All the best,Leniel - Anonymous
April 26, 2012
The comment has been removed - Anonymous
August 14, 2013
Thanks Aseeem for the tips. However, I enabled the tptracelevel =4 in vstest.discoveryengine.x86.exe and ran unit tests in VS. But I didnt see the logs in %Temp% folder (yea, i was looking at the right place).I changed the TPTraceLevel in vstest.console.exe as well. When I ran the unit tests directly vstest.console.exe, the logs were generated.It kind of tells me that when the process is launche via VS (i.e a child process) this technique does not work. Do you know how to get around this problem? - Anonymous
October 06, 2013
Varun, You can restart VS to get the logs enabled for discovery engine process. - Anonymous
September 05, 2014
Test discovery is not working for me from a particular solution. The same tests are discovered from a different solution. I enabled logging and I see messages about paths being too long, even though the paths are only around 140 characters, well within the limit.E, 11756, 12, 2014/09/05, 12:54:23.409, 175558430092, vstest.discoveryengine.x86.exe, TmiDiscoveryRequest: Error occured while discovering tests from source E:tfs-RV-2013CoreMainlineWebTestUnitTestsBonePlacerOrderRedirectorUnitTestbinDebugBonePlacerOrderRedirectorUnitTest.dll. System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. - Anonymous
September 08, 2014
The comment has been removed