Updating Elements of the XML Collection

Applies to TestComplete 15.47, last modified on January 20, 2023

The XML collection of the Stores project item contains XMLCheckpoint elements used to compare and verify XML data. You can update data stored by XMLCheckpoint elements replacing it with new data from tests or from the test log after the test run is over.

Note: If you need to perform minor modifications to data stored by XMLCheckpoint elements, you can do that manually in the XMLCheckpoint editor. You can also modify stored data in tests. For more information, see Modifying Elements of the XML Collection.

Updating XMLCheckpoint Elements From Tests

You can update the contents of the XMLCheckpoint elements by calling the Compare or Check method of the XMLCheckpoint object or using XML checkpoints or web service checkpoints. Usually, the methods and checkpoints are used to compare stored XML data against actual XML data, but they can also replace stored data with values retrieved from XML documents instead of comparing them.

To activate this behavior, enable the Update XML data option in the Stores Options dialog. When this option is enabled, the methods and checkpoints will retrieve XML data from the source specified by the method or checkpoint parameter and store them to the XMLCheckpoint element.

For example, the following code demonstrates how to use the Check method to update the XML data.

JavaScript, JScript

WebServices.SampleWebService.GetArray();
// Replaces data stored by the GetArray XMLCheckpoint element
// With data returned by the GetArray method of the SampleWebService web service
// Instead of comparing them
XML.GetArray.Check(WebServices.SampleWebService);

Python

WebServices.SampleWebService.GetArray()
# Replaces data stored by the GetArray XMLCheckpoint element
# With data returned by the GetArray method of the SampleWebService web service
# Instead of comparing them
XML.GetArray.Check(WebServices.SampleWebService)

VBScript

Call WebServices.SampleWebService.GetArray
' Replaces data stored by the GetArray XMLCheckpoint element
' With data returned by the GetArray method of the SampleWebService web service
' Instead of comparing them
XML.GetArray.Check WebServices.SampleWebService

DelphiScript

WebServices.SampleWebService.GetArray();
// Replaces data stored by the GetArray XMLCheckpoint element
// With data returned by the GetArray method of the SampleWebService web service
// Instead of comparing them
XML.GetArray.Check[WebServices.SampleWebService];

C++Script, C#Script

WebServices["SampleWebService"]["GetArray"]();
// Replaces data stored by the GetArray XMLCheckpoint element
// With data returned by the GetArray method of the SampleWebService web service
// Instead of comparing them
XML["GetArray"]["Check"](WebServices["SampleWebService"]);

To update XML data from keyword tests, use the XML Checkpoint or Web Service Checkpoint operations or call the XMLCheckpoint.Check or XMLCheckpoint.Compare method using the Call Object Method, Run Code Snippet or Run Script Routine operation.

Updating XMLCheckpoint Elements From Logs

If an XML checkpoint or a web service checkpoint that uses an XMLCheckpoint element for comparison fails during the test, you can update the XMLCheckpoint element’s contents from the test log after the test run is over. For more information, see Updating XML Checkpoints.

See Also

About XML Collection
Modifying Elements of the XML Collection
About XML Checkpoints
About Web Service Checkpoints

Highlight search results