Add contain verification points

With contain verification points, you can check that one or several elements of the XML content returned by a service match the XML fragment specified in the verification point.

When you add verification points, the results from a service response are compared with the expected content specified in the verification point test element. Equal or contain verification points enable you to directly compare the XML contents that the service returns.

  1. Open the test editor, and select a service response element.

  2. In the Test Element Details area, click the Message tab and select the Form or Tree view.

  3. Expand the envelope line, right click the element to check, and then click Create Contain Verification Point. This action creates a contain verification point that includes the XML element from the recorded response.

    You can also create a contain verification point with the message response by selecting the message response in the Test Contents pane and clicking Add > Contain Verification Point. However, the result is effectively the same as an equal verification point because the verification point contains the entire XML content of the message response.

  4. Select the verification point, and in the Test Element Details pane, type a name for the verification point.

  5. Select the verification options:

    • Select the Test using XML namespaces check box to perform the verification on the qualified structure of the XML document, including the namespace tagging, instead of the simple name. Disable this option to check only the simple name of the element and the final return value.

    • Select the Test XML text nodes check box to include the content of text elements in the verification.

    • Select the Test XML attributes check box to include the content of attributes in the verification.

  6. If necessary, select the Form, Tree, or Source views to edit the expected XML fragment.

    For an equal verification point, the expected XML data contains the XML document from the response test element. If necessary, you can edit the expected XML data.

    You can specify standard Java™ regular expressions in the Tree view. Select the Regular expression column on the line of an attribute or text value and set the regular expression in the Value column. For example, the following regular expression checks for a correctly formatted email address: /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/

    When using regular expressions, the number of XML nodes or XML fragments in the verification point must match the number of expected nodes. The verification point returns a Pass status when all regular expressions in the XML fragment are matched.


Example

You can use a contain verification point to check that the message response contains only a specific element with a specific value. For example, consider the following message response:

<s:Envelope
 xmlns:a="http://www.w3.org/2005/08/addressing"
 xmlns:s="http://www.w3.org/2003/05/soap-envelope">
  <s:Header>
    <a:Action
     s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</a:Action>
    <a:RelatesTo>uuid:ed9bc447-d739-452f-989d-cd48344d494a</a:RelatesTo>
  </s:Header>
  <s:Body>
    <s:Fault>
      <s:Code>
        <s:Value>s:Sender</s:Value>
        <s:Subcode>
          <s:Value
           xmlns:a="http://schemas.xmlsoap.org/ws/2005/02/sc">a:BadContextToken</s:Value>
        </s:Subcode>
      </s:Code>
      <s:Reason>
        <s:Text
         xml:lang="en-US">The message could not be processed. This is most likely because the action &apos;http://Samples.ICalculator/Add&apos; is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint&apos;s binding.</s:Text>
      </s:Reason>
      <s:Node>http://www.w3.org/1999/xlink</s:Node>
      <s:Role>http://www.w3.org/1999/xlink</s:Role>
      <s:Detail
       xmlns:tns0="http://schemas.com/2003/10/Serialization/"
       xmlns:tns15="http://Samples.Windows"
       tns0:Id="id"
       tns0:Ref="idref">
        <tns15:GetCallerIdentityResponse>
          <tns15:GetCallerIdentityResult>str</tns15:GetCallerIdentityResult>
        </tns15:GetCallerIdentityResponse>
      </s:Detail>
    </s:Fault>
  </s:Body>
</s:Envelope>

To check for the Subcode element, the expected content of the contain verification point is the following XML fragment:

<s:Subcode
  xmlns:a="http://www.w3.org/2005/08/addressing"
  xmlns:s="http://www.w3.org/2003/05/soap-envelope">
   <s:Value
   xmlns:a="http://schemas.xmlsoap.org/ws/2005/02/sc">a:BadContextToken</s:Value>
</s:Subcode>

By default, the contain verification point checks whether an element named Subcode contains one element named Value. You can use the following options:

To check that the Detail element properly returns a specific value for GetCallerIdentityResult, the expected content of the contain verification point is the following XML fragment:

<s:Detail
 xmlns:a="http://www.w3.org/2005/08/addressing"
 xmlns:s="http://www.w3.org/2003/05/soap-envelope"
 xmlns:tns0="http://schemas.com/2003/10/Serialization/"
 xmlns:tns15="http://Samples.Windows"
 tns0:Id="regular_expression"
 tns0:Ref="idref">
  <tns15:GetCallerIdentityResponse>
    <tns15:GetCallerIdentityResult>IdentityValue</tns15:GetCallerIdentityResult>
  </tns15:GetCallerIdentityResponse>
</s:Detail>
You can use the following options:


What to do next

Enable or disable each verification point by right-clicking the verification point in the test editor and clicking Enable or Disable.


Add equal verification points
Add Xpath query verification points
Add attachment verification points
Add XSD verification points


Error 404 - Not Found

Error 404 - Not Found

The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.