How the XML Verification Procedure Works

Applies to TestComplete 14.30, last modified on November 21, 2019

XML checkpoints in TestComplete check the contents of specified XML documents by comparing them with the baseline copy stored in your project as the XMLCheckpoint element of the Stores | XML collection.

This topic describes how the XML checkpoint verification procedure works.

  • When you run a test, the XML checkpoint accesses the XML document whose contents will be checked. It waits for it for some period of time specified by the Auto-wait timeout setting. If the XML document has not been found by the end of the delay, comparison fails.

  • The checkpoint obtains the actual contents of the XML document and checks it against baseline data stored in the project's XMLCheckpoint element. To do this, TestComplete goes down the hierarchy of document elements and compares each element node. The check starts from the root nodes. For each node TestComplete performs the following actions:

    • Finds the appropriate node in the documents. Depending on the Ignore node order setting TestComplete may also check the node's position in the documents.

    • After the appropriate node is found, TestComplete compares the nodes' values.

    • Then, if the Ignore attributes is disabled, TestComplete compares the nodes' attributes and namespace declarations (the comparison of namespace declarations can be skipped by enabling the Ignore namespace declaration setting).

    • Then, TestComplete obtains the list of child nodes and continues the comparison with the child nodes.

    • If the compared nodes or their child nodes differ from each other, TestComplete reports the compared nodes as different.

When searching for a node, TestComplete uses the following parameters to identify a node:

  • The node's baseName property. This property is defined by the Microsoft XML DOM library. It specifies the right-qualified name of the node, that is, the node's name without the namespace prefix (for instance, it returns elem for the node ns1:elem).

  • The node's namespaceURI property. Like baseName, this property defined by Microsoft XML DOM. It specifies the universal resource identifier of the node's namespace. Do not confuse this value with the namespace name. For instance, in the following code snippet, the elem nodes have the same namespaceURI while they belong to different namespaces (the namespaceURI is marked with blue):

    <parentNode xmlns:ns1="http://www.mycomp.com/ns">
      <ns1:elem attr1="yes" attr2="ABC" …>

    -- and --

    <parentNode xmlns:ns2="http://www.mycomp.com/ns">
      <ns2:elem attr1="no" attr2="XYZ" …>

    The following elem nodes have different namespaceURI values: http://www.mycomp.com/ns1 and http://www.mycomp.com/ns2. So, these nodes will be reported as different despite the fact that other recognition parameters (baseName, prefix and type) coincide:

    <parentNode xmlns:ns="http://www.mycomp.com/ns1">
      <ns:elem attr1="1" attr2="abc"/>

    -- and --

    <parentNode xmlns:ns="http://www.mycomp.com/ns2">
      <ns:elem attr1="1" attr2="abc"/>

  • The node's prefix. The prefixes are compared only if the Ignore prefixes setting is disabled. Note that this setting only controls the prefix name (that is, the node's namespace name), but not the node's namespaceURI.

  • The node's type (element, processing instruction, attribute and so on).

See Also

XML Checkpoints
XML Checkpoints
Check Method
XML Checkpoint Operation

Highlight search results