As stated in Part 1, TestComplete 4 stores test results in an "open" XML format in the Log subfolder of your project or project suite folder. You can view these results using TestComplete or export the results to an external file. Also, the "open" XML format allows users to parse the log for various uses. While TestComplete 3 used XML in the log as well, the XML structure of TestComplete 4 has changed.
The Log files are not the only files that have the "open" XML formatting. All of the project files also have this format. I will discuss these files in Part 3 of this blog.
Analyzing Log File Structures and Scheme
The easiest way to analyze and use the xml data from the log file is to export that data from TestComplete 4 to the Unpacked Storage. Exporting the log from TestComplete 4 to the Unpacked Storage produces the following files: *.htm, *.gif, *.htc, *.js, *.css which are the files needed to view the exported logs in Internet Explorer; root.xml which contains a description of the hierarchy of exported logs; *.xml which contain log data; and *.xsd which contain descriptions of data schemes for the exported logs.
We will start by analyzing the scheme of the log. According to the scheme below, each set of data for the ScriptLog type consists of a sequence of elements for the ScriptLogItem. ScriptLogItem consists of a set of fields and attributes. For example, the Message field of the
aqds:string attribute and the id attribute of the
The fields can be one of the following types:
aqds:string - a string type
aqds:text - a string of text for memos and decriptions that may contain line breaks and tab symbols, releated to the Remarks section of the Test Log
aqds:image - an icon in the JPG format, for example, the icon for messages
aqds:picture - a large image in the JPG format, usually the partial or whole image of the application under test
aqds:datetime - data type field
aqds:boolean - a logical type (True|False)
aqds:int - an integer-valued type
aqds:float - a data type with a floating point
aqds:hyperlink - a reference to some resource
aqds:table - a compound (tabular) type
aqds:tree - a compound (tabular) type with the hierarchy of records
The scheme also includes the following attributes:
id - the element (record) identifier
pid - the parent element (record) identifier
nety - a logical flag that indicates that a given element (record) has child elements (records)
The following is a sample of the script log file, which corresponds to the described scheme above:
Using the code snippet above, you can see which tags and data match the fields in the following log image. For example,
<[CDATA[An error with priority = pmHigher]]> displays in the Remarks section of the log, the 11051549.jpg is the Type icon and the
<[CDATA[An error]]> message displays in the Message field.
Test Log Fields
Using the given scheme, we can create a path to the data in the following way:
For example, the path used to obtain data from the Remarks field of the recorded script log with the identifier "0" will look like this:
The path used to select child elements of the record with the identifier "0" will look like this:
And so on, in accordance with XPath rules.
Stay tuned for Part 3 of this blog which details the project files xml format.