To quickly add validations to your SOAP Client and REST Client tools, you can create assertor tools directly from the CTP interface. For SOAP Clients, you can add XML Assertor tools. For REST Clients, you can add either XML or JSON Assertors. Any assertor tools added from CTP will be attached to the response traffic of the selected test.
Asserters and other validation tools are available in the desktop. See:
Additionally, you can edit assertor tools that were added to the response traffic using the desktop product. Any assertor tools that are added to the request traffic using SOAtest desktop will not be visible in CTP.
If you want to check whether all or most parts of a message match a regression control, use a Diff tool. If you want to check a specific element of a message—and/or if you want to validate something other than a match—use an Assertor.
To add a new assertor tool:
The new tool will be "chained" as an output to the response traffic of the selected test client tool.
To configure an assertor tool:
Configure the assertion tool details as appropriate for your selected assertion.
Clicking in the Element field opens the XPath builder, which is described in Specifying XPaths. Select an element in the XPath builder to popular the Element field as well as any other applicable fields (e.g., Expected Value, Expected Type, etc.).
The Trim content option will remove any white space from the start and end of the extracted string before comparing it to the expected text. For example, if " bar " was extracted (ignore quotes in all examples; they are used to show white spaces), it would become "bar"; this would match "bar" (and fail to match " bar ") if the Trim content option was not enabled.
Save expected saves the message received by the associated test client. This message is used by the XPath builder.
The following types of assertions can be added to assertors.
|Value Assertion||Enforce the value of a particular element.|
|Value Occurrence Assertion||Enforce a certain number of occurrences of an element with a given value (e.g., that the document must have n matches on both the XPath selector and the specified value string).|
|Numeric Assertion||Enforce the numeric value of an element.|
|String Comparison Assertion||Enforce the value of the text content of a given element.|
|Regular Expression Assertion||Enforce that an element matches a regular expression|
|Occurrence Assertion||Enforce the number of occurrences of an element.|
|Has Content Assertion||Enforce that an element has text content (i.e., length of text > 0).|
Enforce the type of an element.
This is available for JSON Assertors only.
|Numeric Range Assertion||Enforce that the numeric value of an element is within the inclusive bounds of a numeric range.|
|Date Range Assertion||Enforce a date range on a value of a particular element.|
|Date Time Range Assertion||Enforce a date time range on a value of a particular element.|