Published by Christian on Mon, 05/27/2013 - 11:13
At the end of the automated test script execution, all we expect is a good nicely presented result report to analyse the tests quickly and in a better way. TestComplete offers ‘Test Log’, which contains details of all the actions performed during automated test runs. It contains all relevant information about the test run, such as the test name, the start and end time of the test run, the number of passed and failed test items, the total number of errors and warnings occurred, the results of each test operation and so on. Logs can also include images of the tested application, links to files and other kinds of entries.
Test Log is getting generated always and is opened by default at the end of each test execution. You can view all the test logs (current and previous) from Project Explorer. Logs can also be viewed when you pause the execution, if you have the ‘Show logs on pause’ option is enabled.
Features of Test Log
Detailed Log of actions performed: TestComplete generates a detailed test logs of all the actions performed, using which you can have a better analysis on the result, error and issues if any.
Fixing Errors easily: During the analysis, if you find an error or issue in your test script, test logs gives you ability to directly jump to the code statement where the issue occurs. A double-click on a log entry brings you to the corresponding automated test operation in your script.
Export to Other Formats:Logs can be viewed directly in TestComplete, or they can be exported to HTML, XML or MHT for viewing on machines that do not have TestComplete installed. You can also print test results, export them to a file, send them by e-mail or submit them to an issue-tracking system. You can export entire test log or a particular row, just right click the desired node in log tree or right click in the detail row and select export to option from the menu.
Filter results: Test Log displays Errors, Warning, Message, Event and Checkpoints. You can choose to display the information you are interested in or set to display all. Just select the required options to filter at test log panel.
Test Log Filter Options
Posting Information to Test Log
As you have seen above, Test Log contains all such information, we will now see how these information can be posted. You can post test log from your scripts using the
Log object. Its methods allow you to insert items of different kinds into the test log as well as to create folders in the log. So for posting an error message call Error method, for Warning call Warning method and so on. for example to post an information into log, you will need to use
Log.Message "Test Message", "This is a test message", pmNormal
To post an error
Log.Error "Test Error", "This is a test Error", pmHighest
Where pmNormal and pmHighest are the built-in constants for priority. The complete list of such constants is below.
However, you can post the error, messages, warnings etc without these additional information too. for example –
Log.Error "This is a test Error"
Below tables list the properties and methods of Log Object, this is has been taken from smartbear website.
CallStackSettings Provides scripting interfaces to settings that enables or disables the call stack tracing for methods that post messages to the log.
CheckpointCount Returns the number of checkpoint messages posted to the log by the current test item.
Enabled Specifies whether to allow the posting of folders and messages of all kinds to the test log.
ErrCount Returns the number of error messages posted to the log by the current test item.
EvnCount Returns the number of event messages posted to the log by the current test item.
FileCount Returns the number of file messages posted to the log by the current test item.
FolderCheckpointCount Returns the number of checkpoint messages posted to the specified log folder by the current test item.
FolderErrCount Returns the number of error messages posted to the specified log folder by the current test item.
FolderEvnCount Returns the number of event messages posted to the specified log folder by the current test item.
FolderFileAndLinkCount Returns the number of files and file links posted to the specified log folder by the current test item.
FolderImgCount Returns the number of image messages posted to the specified log folder by the current test item.
FolderMsgCount Returns the number of informative messages posted to the specified log folder by the current test item.
FolderWrnCount Returns the number of warning messages posted to the specified log folder by the current test item.
ImgCount Returns the number of image messages posted to the log by the current test item.
LinkCount Returns the number of file link messages posted to the log by the current test item.
MsgCount Returns the number of information messages posted to the log by the current test item.
Path Returns the name of the file (including the path) that holds a list of test results.
WrnCount Returns the number of warning messages posted to the log by the current test item.
AppendFolder Creates a folder in the test log and activates the folder so that all posted messages are sent to this folder.
Checkpoint Posts a checkpoint message to the test log.
CreateFolder Creates a folder in the test log. This folder can hold messages of different types and subfolders.
CreateIssueFromCurrentLog Posts the log contents to an issue-tracking system.
CreateNewAttributes Creates a new object that defines font and color settings to be applied to test log messages and folders.
CreatePictureConfiguration Creates a new object that will specify the format settings for images posted to the test log.
Error Posts an error to the test log.
Event Posts an event to the test log.
File Posts a file to the test log.
FolderCount Returns the number of folders created in the log by the current test item.
Link Posts a reference to a file or to any other resource to the test log.
LockEvents Turns off event logging until
UnlockEvents is called. The optional Count parameter sets the number of latest events to keep in a safety buffer. They will be added to the log when posting an error or warning message.
Message Posts an informative message to the test log.
Picture Posts an image to the test log.
PopLogFolder Pops the folder, which is currently at the top of the folder stack, out of the stack. This makes the folder that will be at the top of the stack the default folder of the test log.
PushLogFolder Pushes the specified folder to the top of the folder stack. As a result, by default, messages of different kinds will be posted to this folder and new folders will be created there.
SaveResultsAs Saves the current test log results to one or several files in a particular format.
SaveToDisk Generates intermediate test results and saves them to the log item collection.
SetDefaultPictureConfiguration Specifies the format settings for images posted to the test log.
UnlockEvents Re-enables event logging.
Warning Posts a warning to the test log.
So this was all about basic usage and features of Test Log, which will enable you to start working with test log in testcomplete. we will discuss other advanced topics and deep discussion on working with test logs in other posts. stay tuned.. subscribe to our updates by just entering your email id in the form below.