You can use the following assertions to verify functioning of REST, SOAP and JMS virtual services:
Property Content
Common
Contains |
Checks if the incoming request body contains specific data. Fails, if the body has no such data. |
Not Contains |
Checks if the incoming request body does not contain specific data. Fails, if the body contains this data. |
Available for XML request bodies
Message Content Assertion |
Lets you build a complex check that includes multiple smaller checks of XML data. Each smaller check can use its own condition and expected value. |
XPath Match |
Checks if the incoming request body contains a specific node (element or attribute) and if the node value equals to the expected value. To extract data from the request body, the assertion uses an XPath expression. |
XQuery Match |
Checks if the incoming request body contains specific data. To extract data from the request body, the assertion uses XQuery code. |
Available for JSON request bodies
Note: The following assertions use JsonPath expressions to extract data from the body of an incoming request.
JsonPath Count |
Counts the number of occurrences of a specific element in the incoming request body. Fails if this number differs from the expected value. |
JsonPath Existence Match |
Checks if the incoming request body contains a specific element. |
JsonPath Match |
Extracts data from the incoming request body and compares it against an expected value. |
JsonPath RegEx Match |
Extracts data from the incoming request, applies regular expressions to it and compares the result with an expected value. |
Compliance, Status and Standards
HTTP Header Exists |
Checks whether the request contains a specific HTTP header. Fails if the request does not have this header. |
HTTP Header Equals |
Checks whether the request contains a specific HTTP header with a specific value. Fails if the header does not exists or has an unexpected value. |
Swagger Compliance |
Checks whether the request complies with a specific Swagger definition. Fails if the request does not comply with the definition. |
Script
Script |
This assertion uses a Groovy script to perform arbitrary checks of incoming requests. The script should return true or false to signal whether the assertion passes or fails. |
See Also
Validating Virtual APIs