Tuesday 27 May 2014

Getting Detailed Test Results From Coded UI Tests (CUIT)


Coded UI Tests can fail for a number of reasons, producing detailed logs that can be used to rapidly identify what caused the failure. The interesting characteristic about the logs produced by the tests, is that each action results in a detailed entry consisting of information about the how to find the control, the technology used to find the control and a screenshot of the action including a red box above the control upon which the action is performed. These details can help identify if the CUIT has been able to find the right control. It can also help locate instances where the target control is missing.

image

To enable this level of detail in the test results, open explorer and go to the following folder
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\
In this location you will find QTAgent32.exe.config. This is that first file that I usually modify to augment the verbosity of the logs. Before opening files in this directory, be sure that you have the permissions to edit and save files.

Locate the following section in the configuration file and set the “EqTraceLevel” to 4.
<system.diagnostics>
  <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>

Then scroll down to the appSettings section and a key “EnableHttpLogger” with a value of “true”. Then add another key “EnableSnapshotInfo” with a value of “true”. I read that “EnableSnapshotInfo” was not required for the RTM version of Visual Studio 2012, but I kept it around for my last test.
  <appSettings>

    <add key="EnableSnapshotInfo" value="true"/>
    <add key="EnableHttpLogger" value="true"/>

    <add key="StopTestRunCallTimeoutInSeconds" value="5"/>
    <add key="LogSizeLimitInMegs" value="20"/>
    <add key="CreateTraceListener" value="no"/>
    <add key="GetCollectorDataTimeout" value="300"/>
  </appSettings>
The following are the names of the other QTAgent configuration files found in the same location.
QTAgent.exe.config
QTAgent_35.exe.config
QTAgent32_40.exe.config
QTAgent_40.exe.config
QTAgent32_35.exe.config
QTAgent32_40.exe.config
QTDCAgent.exe.config
QTDCAgent32.exe.config

No comments:

Post a Comment