How to generate logs with CodedUI?

Why logs? Well, it helps to debug the problem in our script. Usually logging and capturing the screenshots are not enable by default with CodedUI and to make it, we need to make some set up.

Follow the below steps to enable logging and capturing the screenshots-

1: Go to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE location and search for ‘QTAgent32_40.exe.config’ and ‘QTAgent32.exe.config’. Make sure you have edit permission for these config files.

2: Modify the value for ‘EqtTraceLevel‘:

Log

3: Add App.config file in your project and add the following code under the configuration node:

Log1

4: Add following code in CodedUITest1.cs file-

Log2

5: Now run the test.

6: Open Test Explorer and click on Output hyperlink-

Log3

7: Click on UITestActionLog.html link.

Log4

8: Now check your script logs-

Log5

Log6