Creating Web Service Checkpoints

Applies to TestComplete 15.70, last modified on December 17, 2024
Testing web services with TestComplete is obsolete. We recommend that you use ReadyAPI, another SmartBear's automated testing tool for SOAP and REST web services.
If needed, you can run ReadyAPI tests from TestComplete.

This topic explains how you can create a web service checkpoint to verify results of the needed web service method call.

To work with Web service checkpoints, add a Web Service element to your project. This element should correspond to the web service under test. You need to create such elements for each web service under test.

You can create web service checkpoints both during test recording and at design time. To help you set up web service checkpoints, TestComplete provides the Checkpoint Wizard.

Below are detailed instructions on using the wizard:

1. Launching the Wizard

  1. Select the Checkpoints category in the Operations panel of the Keyword Test editor.

  2. Find the Web Service Checkpoint operation in the list and drag it to your test:

    Web Service Checkpoint: Adding Web Service checkpoints to keyword tests

2. Specifying a Method of the Web Service Under Test

On the following pages of the wizard, specify the needed web service and its method to be called by the checkpoint:

Web Service Checkpoint: Selecting a web service method

Click the image to enlarge it.

  1. Select the WebService project element that corresponds to the web service under test (you need to create such an element for each web service under test).

  2. Choose the method of the web service to be called.

The next page shows the list of method parameters.

Column Name Description
Parameter Name Specifies the parameter name (TestComplete reads this name from the web service’s WSDL document).
Parameter Type Specifies the parameter type (TestComplete reads the type name from the web service’s WSDL document).
Parameter Value Specifies the value that will be passed to the method.
  • To specify a parameter of an ordinary type (string, numerical, boolean and so on), enter the desired value into the Parameter Value column.

  • To specify complex parameter values (that refer to objects), click the ellipsis button in the Parameter Value column and specify the parameter in the subsequent Complex Parameter dialog.

Web Service Checkpoint: Specifying method parameters

Click the image to enlarge it.

3. Specifying the Baseline XML Checkpoint Element

On the last page of the wizard, you specify the XMLCheckpoint project element that will store the expected response of the web service’s method:

Web Service Checkpoint: Specifying baseline data

Click the image to enlarge it.

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.

4. Closing the Wizard

Click Finish to close the wizard and complete the checkpoint creation.

TestComplete will automatically create (or update) the specified XMLCheckpoint element, and then add a checkpoint to your test.

If you added the checkpoint to a keyword test, TestComplete will insert the Call Object Method and XML Checkpoint operations into the test.

If you add the checkpoint to the script code, then upon closing the wizard, TestComplete will generate script code that will call the method and check the result against data stored by the XMLCheckpoint project element. TestComplete will display the generated code in the Copy Text to Clipboard dialog. Here, you can copy the generated code to the clipboard and then paste it to your script code.

See Also

Web Service Checkpoints
About Web Service Checkpoints
Excluding Variable Data From Verification
About Testing Web Services
About XMLCheckpoint Element Editor
Modifying Elements of the XML Collection

Highlight search results