Enabling Tracing and HtmlLogger in Coded UI Test

Enabling Tracing and HtmlLogger in Coded UI Test

  • Comments 3

Enabling HtmlLogger & Tracing in Coded UI Test

 

There have been a few changes in Visual Studio 2012 how Coded UI Test are run & how to enable logging. Now we can have both .NET v4.0 & v4.5 type Coded UI Test projects. Note this is an extension to previous blog on enabling tracing for Coded UI Test which is also applicable for Coded UI Test as well.

Below are various ways for enabling logs in Coded UI Test

Scenario

Method to enable log

Target framework version v4.0 & no App.config file present in the test project

  1. Open <Visual Studio Installation Folder>\Common7\IDE\QTAgent32_40.exe.config
  2. Modify value for EqtTraceLevel to the log level you want
  3. Save the file

Target framework version v4.5 & no app.config file present in the test project

  1. Open <Visual Studio Installation Folder>\Common7\IDE\QTAgent32.exe.config
  2. Modify value for EqtTraceLevel to the log level you want
  3. Save the file

App.config file present in test project

  1. Open App.config file in the project
  2. Add following entry under configuration node

<system.diagnostics>

    <switches>

      <add name="EqtTraceLevel" value="4" />

    </switches>

  </system.diagnostics>

Enabling logging from Test code itself

Playback.PlaybackSettings.LoggerOverrideState = HtmlLoggerState.AllActionSnapshot;

Please refer to MSDN

 

These same settings are applicable for Visual Studio 2012 Test Agent as well.

 

Note:

In the blog Analyzing Coded UI Tests Using Coded UI Test Logs there are two more configuration settings mentioned for enabling Html Logger in Coded UI Test.

    <add key="EnableHtmlLogger" value="true"/>

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

Both of these settings have been *deprecated* in Visual Studio 2012 RTM.  EqtTraceLevel is the only setting which is required to be modified to enable HtmlLogger

Leave a Comment
  • Please add 1 and 7 and type the answer here:
  • Post
  • In my Common7/IDE folder I don't have QTAgent32_40.exe.config. Thoughts?

  • I've tried to get this going and it's not working... have triple checked file edited correctly, have cleared the check box for Keep test execution running between test runs -- still no html link in output. Not sure what else to try?

  • In VS2013, do the above, plus add to your code:

    "UITestTraceUtility.StartTracing();

Page 1 of 1 (3 items)