Description
The CompareInSubTreeMode
property specifies how TestComplete will compare the nodes of the stored and actual documents when comparing XML documents with the Compare
method of the XMLCheckpoint
object. If the property is True, TestComplete will only compare the values of those nodes that belong to the stored document (that is, the stored nodes must form a subtree of the actual document's nodes tree). In this case, the comparison results will not include messages that inform you about nodes that only exist in the actual document and do not exist in the stored document. These nodes are ignored during the comparison.
Declaration
XMLCheckpointOptionsObj.CompareInSubTreeMode
Read-Write Property | Boolean |
XMLCheckpointOptionsObj | An expression, variable or parameter that specifies a reference to an XMLCheckpointOptions object |
Applies To
The property is applied to the following object:
Property Value
True, if TestComplete will compare XML documents in subtree mode and False otherwise.
Remarks
The XMLCheckpointOptions
object provides access to a copy of the element’s data. Changes made to the comparison settings via the CompareInSubTreeMode
property will not be stored in the XMLCheckpoint element and will not be displayed in the XMLCheckpointOptions Element editor.
Example
The following example demonstrates how you can obtain the XMLCheckpointOtions
object, set its CompareInSubTreeMode
property value to True and compare XMLCheckpoint with the XML document.
JavaScript, JScript
{
var XMLCheckpoint, XMLOptions, XMLDoc;
// Obtains the XMLCheckpoint object.
XMLCheckpoint = XML.MyXMLCheckpoint;
// Obtains the XMLCheckpointOptions object.
XMLOptions = XMLCheckpoint.Options;
// Enables the CompareInSubTreeMode XML checkpoint option.
XMLOptions.CompareInSubTreeMode = true;
// Specifies the XML document path.
XMLDoc = "D:\\Work Folder\\XMLFile.xml";
// Compares MyXMLCheckpoint with the XML document.
XMLCheckpoint.Compare(XMLDoc)
}
Python
def CompareInSubTreeModeDemo():
# Obtains the XMLCheckpoint object.
XMLCheckpoint = XML.MyXMLCheckpoint
# Obtains the XMLCheckpointOptions object.
XMLOptions = XMLCheckpoint.Options
# Enables the CompareInSubTreeMode XML checkpoint option.
XMLOptions.CompareInSubTreeMode = True
# Specifies the XML document path.
XMLDoc = "D:\\Work Folder\\XMLFile.xml"
# Compares MyXMLCheckpoint with the XML document.
XMLCheckpoint.Compare(XMLDoc)
VBScript
Dim XMLCheckpoint, XMLOptions, XMLDoc
' Obtains the XMLCheckpoint object.
Set XMLCheckpoint = XML.MyXMLCheckpoint
' Obtains the XMLCheckpointOptions object.
Set XMLOptions = XMLCheckpoint.Options
' Enables the CompareInSubTreeMode XML checkpoint option.
XMLOptions.CompareInSubTreeMode = True
' Specifies the XML document path.
XMLDoc = "D:\Work Folder\XMLFile.xml"
' Compares MyXMLCheckpoint with the XML document.
XMLCheckpoint.Compare(XMLDoc)
End Sub
DelphiScript
var XMLCheckpoint, XMLOptions, XMLDoc;
begin
// Obtains the XMLCheckpoint object.
XMLCheckpoint := XML.MyXMLCheckpoint;
// Obtains the XMLCheckpointOptions object.
XMLOptions := XMLCheckpoint.Options;
// Enables the CompareInSubTreeMode XML checkpoint option.
XMLOptions.CompareInSubTreeMode := True;
// Specifies the XML document path.
XMLDoc: = 'D:\Work Folder\XMLFile.xml';
// Compares MyXMLCheckpoint with the XML document.
XMLCheckpoint.Compare(XMLDoc);
end;
C++Script, C#Script
{
var XMLCheckpoint, XMLOptions, XMLDoc;
// Obtains the XMLCheckpoint object.
XMLCheckpoint = XML["MyXMLCheckpoint"];
// Obtains the XMLCheckpointOptions object.
XMLOptions = XMLCheckpoint["Options"];
// Enables the CompareInSubTreeMode XML checkpoint option.
XMLOptions["CompareInSubTreeMode"] = true;
// Specifies the XML document path.
XMLDoc = "D:\\Work Folder\\XMLFile.xml";
// Compares MyXMLCheckpoint with the XML document.
XMLCheckpoint["Compare"](XMLDoc)
}
See Also
About XML Collection
Creating XML Checkpoints
About XML Checkpoints
About Web Service Checkpoints