It is best practice to enable Test Logs in any Test Automation tools to better understand the test results to provide immediate solution if you face any problem in your execution. So, like the other tools CodedUI also provides test log tracker to provide us the stack trace of the test result. To enable this feature we can follow 3 ways:
1. Configure your QTAgent config file:
This is a traditional method. In this method you set the configuration options in the QTagent file.
In older versions of visual studio we have keys that sets the test log for out tests.
<add key="EnableHtmlLogger" value="true"/>
<add key="EnableSnapshotInfo" value="true"/>
<add key="EnableSnapshotInfo" value="true"/>
Add these 2 keys to your QTAgent.config file in the IDE directory
<C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE> for 64 bit machines under system.diagnostics node.
In the latest versions of visual studio these 2 keys are depreciated into a single key
as
<!-- 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="0" />
This you find when you open QTAgent32.config file. And it is wise to choose the appropriate config file based on the
.NET framework you use in your test project.
This settings provides you HTML reports, and stack trace of the test result if the test fails.
2. Configure these settings in your app.config file:
If you are confused in identifying the appropriate QTAgent.config file, you better add these settings in your app.config file without disturbing your QTAgent.config file. This will override the settings provided in your QTAgent.config file.
Add the following settings to your app.config file under configuration node:
<system.diagnostics> <switches> <add name="EqtTraceLevel" value="1" /> </switches></system.diagnostics>
Update the EqtraceLevel based on your need.o: Off1: Error2: Warn3: Info4: Verbose
3. Add this setting in your test Code:Add the following code to your test code with out disturbing your QTAgent config file and app config filePlayback.PlaybackSettings.LoggerOverrideState = HtmlLoggerState.AllActionSnapshot;
To know more about Test Log analyzing refer the msdn: http://msdn.microsoft.com/en-us/library/jj159363.aspx
No comments:
Post a Comment