Analyzing Coded UI Tests Using Coded UI Test Logs
Coded UI test logs filter and record important information about your coded UI test runs.
Visual Studio Ultimate, Visual Studio Premium
To configure the output for the coded UI logs, you need to set some configuration settings in the file QTAgent32.exe.config. By default, this file is installed in the following location:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE
You can specify log file output by configuring the existing trace level setting in the QTAgent32.exe.config file. This is done by assigning a value to EqtTraceLevel in the system.diagnostics section.
<add name="EqtTraceLevel" value="0" /> By setting the value to ‘0’, you can exclude HTML log file output.
<add name="EqtTraceLevel" value="1" /> By setting the value to be ‘1’ or higher, coded UI tests will generates an HTML log file.
<add name="EqtTraceLevel" value="3" /> By setting the value to be ‘3’ or higher, screenshots are taken for each action. When the value is set to either 1 or 2, screenshots are taken for error actions only.
If you want to disable the screenshot creation irrespective of the level, add the key <add key="EnableSnapshotInfo" value="true"/> in the appSettings section. For example, the following configuration will provide coded UI test log files that include screenshots for each action taken during the test:
<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="3" /> </switches> </system.diagnostics> <appSettings> <add key="StopTestRunCallTimeoutInSeconds" value="5"/> <add key="LogSizeLimitInMegs" value="20"/> <add key="CreateTraceListener" value="no"/> <add key="GetCollectorDataTimeout" value="300"/> <add key="EnableHtmlLogger" value="true"/> <add key="EnableSnapshotInfo" value="true"/> </appSettings>
With the modifications to the QTAgent32.exe.config file in place, when you run a coded UI test you will see there is an output link in the Test Explorer results. Log files are produced not only when your test fails, but also for successful tests when the trace level is set to “verbose.”
On the TEST menu, choose Windows and then select Test Explorer.
On the BUILD menu, choose Build Solution.
In Test Explorer, select the coded UI test you want to run, open its shortcut menu, and then choose Run Select Tests.
The automated tests will run and indicate if they passed or failed.
To view Test Explorer from the Test menu, point to Windows and then choose Test Explorer.
Choose the Output link in the Test Explorer results.
This displays the output for the test which will include a link to the action log.
Choose the UITestActionLog.html link.
The log is displayed in your web browser.