Check method to compare the data stored in the XMLCheckpoint project element, which the XMLCheckpointObj object corresponds to, with the data of an XML document.
Check method you can also update the XML data stored in the XMLCheckpoint element. TestComplete does this if the Update XML data option is enabled. See Modifying Elements of the XML Collection.
|XMLCheckpointObj||An expression, variable or parameter that specifies a reference to an XMLCheckpoint object|
The method is applied to the following object:
The method has the following parameter:
This parameter specifies the source of the compared XML data. This can be one of the following:
If the content of the XML document coincides with the saved baseline copy, the method returns True and posts a checkpoint message ( ) to the test log. Otherwise, the method returns False and posts an error message ( ) to the log.
Check method returns True or False indicating comparison results. If the verification passes, the method posts a success message to the test log. If the verification fails, the method posts all found differences to the test log.
The method compares XML data according to the comparison settings specified in the XMLCheckpoint project element. Before calling the method, you can modify these options as well as the stored data. You can find more information on changing the settings and data in Creating XML Checkpoints.
By default, if the
Check method cannot find or access the XML document whose content is to be compared, or if the document does not match its baseline copy, the method will wait for the document to become accessible and for the comparison to complete successfully for the period the Auto-wait timeout setting specifies. (Go to Tools > Current Project Properties > Playback to view or modify the setting.) If the method does not access the XML document, or if the document content does not match its baseline copy within this period, the comparison will fail.
You can also use the
Compare method for comparison.
The following example demonstrates how you can compare the stored XML document with an external XML document specified by its full name and path.
def XMLCheckpointCheck(): # Specifies the external XML file. XMLFile = "D:\\Work Folder\\SampleXMLFile.xml" # Obtains the XMLCheckpoint object from script. XMLCheckpoint = XML.MyXMLCheckpoint # Compares the stored XML document with the external XML document. XMLCheckpoint.Check(XMLFile)
The following example demonstrates how you can load XML data to the
IXMLDOMDocument object and compare this data with the stored XML data.
def XMLCheckpointCheck2(): # Creates an object implementing the IXMLDOMDocument interface. # If you have MSXML 4: Doc = Sys.OleObject["Msxml2.DOMDocument.4.0"] # If you have MSXML 6: Doc = Sys.OleObject["Msxml2.DOMDocument.6.0"] XMLDoc = Sys.OleObject["Msxml2.DOMDocument.6.0"] XMLDoc.async = False # Loads the data to the IXMLDOMDocument object from the XML document. XMLDoc.load("D:\\Work Folder\\SampleXMLFile.xml") # Obtains the XMLCheckpoint object from script. XMLCheckpointObject = XML.MyXMLCheckpoint # Compares MyXMLCheckpoint with the IXMLDOMDocument object. XMLCheckpointObject.Check(XMLDoc)