How To: Enable Tracing for “UI Test” Components
Note: Cross posted from Gautam's Blog.
Permalink
Like any other good product, the Testing Tools in VS also have tracing support to generate the extra trace logs that can help the product team debug the customer issues better. Though this trace logs could be used by the customers in certain scenarios, these are meant for the product team only. When reporting a bug or asking for support from the product team via forums or other channels, it is always good to generate the repro with the tracing ON and submit these trace logs too.
Below are various different ways to enable tracing -
The quick and easiest way to enable tracing for all Testing Tools in VS is to use the registry files in the zip attached. The zip has two files – one to enable and another to disable tracing. SECURITY WARNING – Please validate the registry file before importing. The registry file is -
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\EnterpriseTools\QualityTools\Diagnostics] "EnableTracing"=dword:00000001 "TraceLevel"=dword:00000004
In the above, the EnableTracing variable controls whether tracing is ON or OFF.
- 1 means tracing is ON
- And 0 means OFF.
The TraceLevel variable is for level (granularity) of tracing.
- 1 means Errors only
- 2 is Errors and Warnings
- 3 is Errors, Warnings and Information
- 4 is All including Verbose Information
Typically for reporting issues, it is good to set it to 4. Once you have reported the issue, you should turn the tracing off by changing EnableTracing to 0. Alternatively, use the DisableTrace.reg file in the attached zip.
Set EqtTraceLevel or UITestTraceLevel switch as appropriate in the corresponding *.exe.config file. (Typically these values are there towards the end in the config files.) The EqtTraceLevel will turn tracing ON for all Testing Tools modules of the executable whereas UITestTraceLevel will turn ON the tracing for only the UI Test modules of the executables. Here the EqtTraceLevel and UITestTraceLevel has the same 1-4 values like the TraceLevel variable above.
The following are the *.exe.config that you need to modify depending on your scenario -
- For Action Log and Fast Forward feature of MTLM – mtlm.exe.config
- For recording\assertion in Coded UI Test Builder – CodedUITestBuilder.exe.config.
- For playback of Coded UI Test - QTAgent.exe.config. (Note – In case of remote playback, you need to modify QTAgent.exe.config of the remote machine.)
All the above config files are located at “ %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE” where the part in bold is the default installation directory. If you have changed the installation directory of the product, you need to replace it appropriately here too. To disable you will have to turn off the setting in the same file.
Note that for trace settings changes to take affect, the executable (VS or MTLM or others) need to closed and restarted.
For UI Test, the trace file is generated in %temp%\UITestLogs\*\LastRun\UITestLog.html where * could be empty for VS or could be exe name like CodedUITestBuilder for other cases. The LastRun here indicates that this is THE file for last run – the earlier ones would be stored as PreviousRunXX. The tool automatically cleans up old trace file if it exceeds ‘n’ (today it is 25) previous runs.
Note: Cross posted from Gautam's Blog.
Permalink