This topic covers the XML Assertor tool in SOAtest and Virtualize. This tool enforces the correctness of data in an XML message. This tool requires a validate license.
Sections include:
Table of Contents | ||
---|---|---|
|
...
- Click the Add button in the XML Assertor’s Configuration tab.
The Select Assertion wizard displays. - Select an assertion type. The following is a brief summary of the available types of assertions.
- Value Assertions: The following value assertions are available:
- 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.
- Expression Assertion: Enforce the value of an expression composed of elements.
- Custom Assertion: Enforce the value of an element by scripting custom logic.
- Structure Assertions: The following structure assertions are available:
- 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).
- Has Children Assertion: Enforce that an element has one or more child elements.
- Compound Assertions: The following compound assertions are available:
- AND Assertion: Group multiple assertions that all must succeed.
- OR Assertion: Group multiple assertions where at least one must succeed.
- Conditional Assertion: Enforce an assertion only if a condition is met (where the condition is a combination of previously-defined assertions).
- Difference Assertions: The following difference assertions are available:
- Numeric Difference Assertion: Enforce a numeric difference on a value of a particular element. Assert that the numeric value of an element differs from a user-specified base value by a user-specified value. For example, in order to assert that a value in degrees Fahrenheit is 3 degrees below freezing, you would set the Base Value to 32 and the Difference Value to -3.
- Date Difference Assertion: Enforce a date difference on a value of a particular element.
- DateTime Difference Assertion: Enforce a date time difference on a value of a particular element.
- Range Assertions: The following difference assertions are available:
- 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
- DateTime Range Assertion: Enforce a date time range on a value of a particular element
- Value Assertions: The following value assertions are available:
- Click the Next button. A tree view displays.
Select the element that you want this assertion to check, then click the Finish button. Note that you can edit the structure of this tree in the XML Assertor tool’s Expected XML tab.
By default, XPath fields are case sensitive, but you can change case sensitivity by specifying the applicable system property when starting Virtualize. See Case Sensitivity for details.
You may add additional assertions to apply to the message (such as a Numeric assertion to enforce on the price element) by clicking the Add button in the Configuration tab.
...
namespace-uri(.)=""][child::node()[local-name(.)="title" and text()="${XPath Key}"]]
Scroll pdf ignore | |||||||||
---|---|---|---|---|---|---|---|---|---|
Video TutorialIn this video, you'll learn how to add targeted assertions for values in XML responses.
|
Related Tutorials
The following tutorial lessons demonstrate how to use this tool:
...