Parameterizing XML Checkpoints

Applies to TestComplete 14.0, last modified on January 23, 2019

XML checkpoints in TestComplete check the contents of a specified XML document by comparing it with the baseline copy stored in your project as an XMLCheckpoint element.

The XML checkpoint takes only one parameter - the source of XML data to be checked. This parameter can be one of the following:

  • The fully qualified name or URL of the desired XML document (it lets you compare the stored data with any XML file).

  • The IXMLDOMDocument object (it lets you compare the stored data with any XML document).

  • An XMLCheckpoint object (it lets you compare the stored data with data of another XMLCheckpoint element).

  • A WebService object (this functionality is used to create web service checkpoints).

If you want to re-use an XML checkpoint in your test, for example, to check multiple XML documents against the same baseline XML document, you can replace the hard-coded XML source with a parameter that obtains the desired XML document before the checkpoint is called. In other words, you may want to parameterize your XML checkpoint.

This topic describes how to parameterize your XML checkpoints:

In Keyword Tests

To parameterize your XML checkpoints in keyword tests, in the Operation Parameters dialog of the XML Checkpoint operation, replace the hard-coded name of the XML source with a keyword test parameter or with a keyword test, project or project suite variable containing the desired XML source.

The image below demonstrates two XML checkpoints. One of them verifies a hard-coded XML document, the other one verifies an XML document whose source is specified in the param1 keyword test parameter.

Parameterized File Checkpoint Operation

In Scripts

To parameterize your XML checkpoint in a script test, replace the hard-coded XML document passed to the XML.XMLCheckpointName.Check method with a script routine parameter or with a script, project or project suite variable containing the desired XML document.

The following routine demonstrates two XML checkpoints. One of them verifies a hard-coded XML document and the other one - the XML document, whose source is specified by the param1 parameter of the script routine:

JavaScript, JScript

function Test(param1)
{

  …

  XML.XmlCheckpoint1.Check("C:\\Work\\Data.xml");

  …

  XML.XmlCheckpoint1.Check(param1);

  …

}

Python

def Test(param1):

  ...

  XML.XmlCheckpoint1.Check("C:\\Work\\Data.xml")

  ...

  XML.XmlCheckpoint1.Check(param1)

  ...

VBScript

Sub Test(param1)

  …

  XML.XmlCheckpoint1.Check("C:\Work\Data.xml")

  …

  XML.XmlCheckpoint1.Check(param1)

  …

End Sub

DelphiScript

procedure Test(param1);
begin

  …

  XML.XmlCheckpoint1.Check('C:\Work\Data.xml');

  …

  XML.XmlCheckpoint1.Check(param1);

  …

end;

C++Script, C#Script

function Test(param1)
{

  …

  XML["XmlCheckpoint1"]["Check"]("C:\\Work\\Data.xml");

  …

  XML["XmlCheckpoint1"]["Check"](param1);

  …

}

See Also

XML Checkpoints
XML Checkpoints
XML Checkpoint Operation
Check Method
Parameterizing Tests

Highlight search results