TestComplete samples (both built-in and additional) are located in the <Users>\Public\Public Documents\TestComplete 15 Samples folder.
Some file managers display the Public Documents folder as Documents.
An XML checkpoint is a test operation that verifies values of an XML document by comparing them with baseline values stored in your project. This may be necessary if the application under test exports data, for example, a customer list, into an XML file and you need to verify that the application generates the file correctly.
In keyword tests, XML checkpoints are performed using the XML Checkpoint operation:
In scripts, XML checkpoints are performed using the XML.XMLCheckpointName.Check
method:
JavaScript, JScript
Python
XML.XmlCheckpoint1.Check("C:\\Work\\test.xml")
VBScript
DelphiScript
C++Script, C#Script
The baseline copy of the XML data against which the actual XML document will be checked is stored in your project's Stores > XML collection. Each XMLCheckpoint element of the collection contains the baseline copy of XML data and checkpoint options that affect verification. To view and modify them, use the XMLCheckpoint Element editor.
The XML checkpoint takes only one parameter - the source of XML data to be checked. The source can be one of the following:
-
The fully qualified name or URL of the desired XML document.
-
An
IXMLDOMDocument
object. -
An
XMLCheckpoint
object providing scripting access to another XMLCheckpoint element in your project. -
A
WebService
object.
How to Create XML Checkpoints
You can add XML checkpoints to your tests during the test recording and at design time.
TestComplete provides the XML Checkpoint wizard that guides you through the process of creating and modifying database checkpoints. For detailed instructions on using the wizard, see Creating XML Checkpoints.
When you create an XML checkpoint, TestComplete retrieves data from the specified XML source and stores it to your project as an XMLCheckpoint element. The data will be used as baseline data during the verification process.
How XML Checkpoints Work
When you run your test, the XML checkpoint obtains the specified XML document and then goes down the document's element hierarchy checking its data against data stored in the corresponding XMLCheckpoint element of your project.
For a detailed description of how the XML checkpoint verification procedure works, see How the XML Verification Procedure Works.
If your XML document contains some variable values, you can exclude them from verification. For information on how to do this, see Excluding XML Data From Verification.
XML Checkpoint Results
If the actual data of the checked XML document and the baseline data stored in your project are equal, the checkpoint posts a success message to the test log.
Otherwise, the checkpoint posts an error message to the test log and brief verification results to the Details panel. It also posts detailed verification results to the XML Checkpoint Results log panel:
For a detailed description of verification results, see Analyzing XML Checkpoint Results.
Note: | To change the type of the message posted to the test log on verification failure or customize the log message of the checkpoints, use one of the alternative approaches described below. |
XML Checkpoint Alternatives
In addition to XML checkpoints, for XML file verification you can use the following approaches:
-
Create a custom verification procedure that obtains the XML document and compares its values with expected ones.
-
Use the
XML.XMLCheckpointElementName.Compare
method. The method is similar to XML checkpoints, but it allows you to specify what kind of message will be posted to the test log if comparison fails. -
Use file checkpoints to verify the XML file contents by comparing it byte-to-byte with the baseline XML file.
For more information, see Alternatives to XML Checkpoints.
Updating XML Checkpoints
If your XML checkpoint fails because the actual data of the verified XML document changed, in order for the checkpoint to be passed successfully, update the corresponding XMLCheckpoint element with new data.
For information on how to do that, see Updating XML Checkpoints.
Samples
TestComplete includes a sample project that demonstrates how to create XML checkpoints:
<TestComplete Samples>\Desktop\Checkpoints\XML
Note: | If you do not have the sample, download the TestComplete Samples installation package from the support.smartbear.com/testcomplete/downloads/samples page of our website and run it. |