Assertions are validations which are used to validate whether the system is working as expected or not.
SoapUI provides you with a variety of assertions, let's have a look at each one of them by category:
Property Content: This assertion type is used to validate the parameter data returned in response by the service
XPath Match: This assertion is used to match a particular node value in the response with the expected values
XQuery Match: When you want to validate multiple sets of values from the response, XQuery Match is used to validate multiple parameters of data in the response in a single assertion
In the preceding example there is an XML which has multiple price tags and the tester wants to retrieve all the prices from an XML response.
So the XQuery searches in every item and returns all the prices for each Item.
Contains: This assertion is used to validate if a particular value or string exists in the response or supports wildcards
NotContains: This assertion is to make sure that a particular string doesn't exist in the response
Compliance status and standards: This Assertion type is used to validate whether the returned status code or fault code adheres to the expected value or not
Invalid HTTP status codes: This Assertion validates whether the returned HTTP Code adheres to the expected value or not
Not SOAP Fault: This Assertion validates that the response received from the service is not a SOAP fault
Note
Note: Automatically added and configured by double-clicking on the name of the assertion
Schema Compliance: This Assertion validates that the received message is compliant with the WSDL or not
SOAP Fault: This assertion validates that the response received is a soap fault or not
Note
Note: Automatically added and configured by double clicking on the name of the assertion
Script: Script assertions are used to create any custom assertion with the help of groovy script
Script Assertion: Script assertion is the best way to implement your own assertion to meet your requirements
Response SLA: This Type of assertion is to validate the response time
Response SLA Assertion: This assertion is to validate the response time of the service and may be used to verify the performance of the service at the initial stages
JMS: This type of assertion is to for services exposed over the JMS protocol.
JMS Status: This Assertion is to validate if the message is posted on the queue or not
Note
This assertion is automatically added and configured
JMS Timeout: This assertion is to validate that the time of execution for the JMS statement is no longer than expected.
Note
This Assertion is automatically added and configured
Security:
Sensitive Information Exposure: This assertion is to make sure that any confidential information like usernames, passwords or server IP is not exposed in the response of the service of which any hacker or intruder may take advantage
That was all about assertions in SoapUI however, when we need a customized assertion we always have the power of groovy script to create our own and achieve our desired functionality.