Checkpoint Wizard - Storing Expected Response (Web Service Checkpoints)

Applies to TestComplete 14.40, last modified on April 22, 2021

On the Store Expected Result Value page of the Checkpoint wizard, you can specify the data, which TestComplete expects to receive as a response from the tested web service, and specify the XMLCheckpoint project element that will store this expected data.

To use an existing element

Click Use a stored value, and then select the desired element from the Stores object name drop-down list.

To create a new element
  1. Click Select the result value and save it to Stores.

  2. Enter the name of the XMLCheckpoint element to be created in the Create a new Stores item box.

    Note: This name will be used to address the element from scripts, so the name must be a valid identifier. To create a name that will match the rules of any scripting language supported by TestComplete, enter a name that starts with a letter and contains only letters, digits and underscore symbols.
If TestComplete fails to obtain a response from the web service (for instance, if the service is temporary unavailable), TestComplete generates the expected response using predefined values for XML document elements that correspond to the result value (or values). For instance, if the method returns an integer value, TestComplete generates the value of 0 for the element that holds the result value.

In that case, you need to replace these predefined values with expected values in the XMLCheckpoint element. Otherwise, comparison will make no sense.

You can also modify the expected response of the web service. Web services use the SOAP protocol that transmit data in XML format. The page includes an editor, which you can use to view and modify the response contents.

To add a node to the tree

To add a new element, attribute or some other node to the XML document, select an item from the menu that is displayed at the top of the node’s tree. This menu contains the following submenus:

  • Element - Adds a new element to the document.

  • Attribute - Adds a new attribute to an element.

  • Text - Adds a text node (#text) to the document.

  • Comment - Adds a comment (<!-- Comment text -->) to the document.

  • CDATA - Adds a CDATA node to the document (<![CDATA[ ... ]]>).

  • PI - Adds a processing instruction (<?xml-stylesheet type="text/xsl" href="../../myTemplate.xsl"?>) or xml declaration nodes to the document (<?xml version="1.0"?>).

Each of these submenus contains three items: Before, After and Child. They specify the position of the new node relative to the currently selected node. For instance, if the currently selected node corresponds to an element, then the Element | After menu item will insert a new element after the currently selected node. The Element | Child item will append a new element as a child of the currently selected element.

The Before, After and Child menu items can be disabled or enabled according to the context. If some menu item is disabled, this means that the appropriate node cannot be added to the document at the appropriate position. For instance, processing instructions, comments or CDATA nodes cannot be child nodes of attributes. So, if the currently selected node corresponds to an attribute, the PI | Child, Comment | Child and CDATA | Child menu items are disabled.

Each element has an appropriate icon:

  • or - Element (for information on differences between these icons, see below)
  • - Attribute
  • - Text
  • - CDATA
  • - Comment
  • - Processing instruction
  • - DOCTYPE
To rename a node
  1. Select the desired node’s name in the tree.

  2. Click the node name or press F2. This will activate the in-place editor.

  3. Enter a new name into the in-place editor. Press Enter to confirm the changes or Esc to cancel them.

To modify the node’s data
  1. Select the cell containing the desired node’s value.

  2. Click the node name or press F2. This will activate an in-place editor.

  3. Enter the desired value into the in-place editor. Use Ctrl+Enter to enter a line break.

    To confirm changes, press Enter. To cancel changes, press Esc.

Note: An element’s node may have the or icon. The icon indicates that the element’s node has a child node (for instance, a #text node) that stores the element’s value. In this case, to set the element’s data, you should modify the value of this child node.

The icon indicates that the element does not have child nodes and the element’s value can be set in the Value column.

To change the node’s position
  1. Select the desired node.
  2. Move the selected node to the desired position in the tree. When moving a node, keep the cursor over the node names rather than icons.

– or –

  1. Select the desired node.
  2. Choose Cut from the dialog’s toolbar. This will remove the node from the tree and copy it to the clipboard. If the node has child nodes, they will also be removed and copied.
  3. Select the node that will be parent for a new node.
  4. Choose Paste from the toolbar to insert the copied node into the new position. If the copied node has child nodes, they are also inserted.
To copy a node to another location
  1. Select the desired node in the tree.
  2. Press Ctrl and hold it pressed while dragging the node to the desired location, keeping the cursor over the node’s names rather than the icons.

– or –

  1. Select the desired node in the tree.
  2. Choose Copy from the dialog’s toolbar. This will copy the selected node along with its child nodes to the clipboard.
  3. Select the node that will be the parent.
  4. Choose Paste from the toolbar to insert the copied node into the new position.

A node is copied along with its child nodes.

To delete a node from the tree
  1. Select the desired node in the tree.
  2. Press Del.

You can also delete the selected node by choosing Delete from the toolbar that is displayed above the tree.

If the selected node has child nodes, they are also deleted.

To undo or redo changes

To undo or redo changes made to the XML data, use the Undo and Redo toolbar items that are displayed above the tree.

To change encoding

By default, TestComplete uses the UTF-8 encoding for the XML data. To change the encoding:

  • Switch to the Source tabbed page.
  • Specify the desired encoding type in the encoding attribute of the xml element.

To create the checkpoint, click Finish. Back will return you to the previous page of the wizard. Cancel will close the wizard and abort the checkpoint creation.

Upon closing the dialog with the Finish button, TestComplete will save the expected response to the specified XMLCheckpoint project element. Then TestComplete will also generate and display the script code that will verify the result of the specified web service’s method.

See Also

Checkpoint Wizard - Configure Web Service Checkpoint
About Web Service Checkpoints

Highlight search results