Partager via


How To: Enable Tracing for “UI Test” Components

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 -

  1. 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 -

    If using VS\MTM 2010 -

    Windows Registry Editor Version 5.00

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\EnterpriseTools\QualityTools\Diagnostics] "EnableTracing"=dword:00000001 "TraceLevel"=dword:00000004

    If using VS\MTM 11 Beta -

    Windows Registry Editor Version 5.00

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.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.

  2. OR 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 – mtm.exe.config
  • For recording\assertion in Coded UI Test Builder – CodedUITestBuilder.exe.config.
  • For playback of Coded UI Test - QTAgent32.exe.config. Note –
      1. In case of remote playback, you need to modify QTAgent32.exe.config of the remote machine.
      2. Coded UI Test always runs under 32 bit context. However, if you are also running Unit Test etc in 64 bit and want to get the logs for those too, you should modify QTAgent.exe.config too.

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.

Once you have collected the logs, refer this blog for best practice around reporting the issues.

Comments

  • Anonymous
    October 03, 2011
    Hi i am not able to see the directory [HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio10.0EnterpriseToolsQualityToolsDiagnostics in the parent [HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio10.0EnterpriseToolsQualityTools what may be the reason for this behaviour

  • Anonymous
    October 04, 2011
    The parent dir may not be there.  Add it.

  • Anonymous
    October 17, 2011
    Does this works for WinXP platform ?

  • Anonymous
    October 24, 2011
    Yes, it should.

  • Anonymous
    March 10, 2012
    Gautam, The MTM11 reg files are pointing to VS10.0

  • Anonymous
    March 11, 2012
    Thanks Clemens.  I have fixed it now.

  • Anonymous
    April 09, 2012
    my  problem is I have a telerik ribbon control which is getting recorded in web version for XBAP application but for desktop version of the same application it is not getting recorded. While recording itself it says control not available and doesn't generate any code. For web version it is able to generate coordinates for these control when I click over there. But for desktop version it is not able to find the control itself. Help is required. Thanks.

  • Anonymous
    April 09, 2012
    @Poonam - It is difficult to say what is the issue here.  I suggest you post it on the forums with logs.  Check blogs.msdn.com/.../forums-are-the-best-place-to-ask-questions.aspx on how to go about this.

  • Anonymous
    May 09, 2012
    Thanks Gautam!!! You really help me a lot!