The Message Content assertion checks the content of messages and properties in accordance with the predefined set of rules.
This assertion is available in multiple ReadyAPI applications. Depending on the application, it validates the following data:
|In...||Checks...||To learn more...|
|Functional tests||The request or response contents.||See Working With Assertions in Functional Tests.|
|Security tests||The response contents.||See Security Assertions.|
|Virtual services||The request contents.||See Assertions in Virtual Services.|
In functional tests, you can add the Message Content assertion whose configuration is based on previously received responses. To do this, click Smart Assertion in the Response editor:
ReadyAPI will analyze the received responses and configure the assertion based on the found patterns.
|Note:||Smart Assertion analyzes only the data collected during the current session of ReadyAPI. If you restart ReadyAPI, you'll have to run a request again before you can add Smart Assertion to it.|
|Send the request at least once, to be able to parse the message.|
When you add the assertion, ReadyAPI sets the default settings for it. If you are satisfied with the setting, click Save. Otherwise, change the assertion settings:
Select the check box next to the node you want to verify.
ReadyAPI will add the
AND operator between the nodes.
Select the comparison operator from the matching drop-down list.
Specify the value you need in the Expected Value column.
If needed, click Reconfigure to reload the values from the last response you have got.
To remove all the selected operators and the expected values, click Clear.
The assertion uses the following comparison operators:
||Checks whether the actual node value equals the expected value.|
||Checks whether the actual node value does not equal the expected value.|
||Checks whether the actual node value is greater than the expected value. For non-numeric values it always fails.|
||Checks whether the actual node value is less than the expected value. For non-numeric values it always fails.|
||Checks whether the actual node value is not less than the expected value. For non-numeric values it always fails.|
||Checks whether the actual node value is not greater than the expected value. For non-numeric values it always fails.|
|exist||Checks whether a node exists in the received message.|
|not exist||Checks whether a node does not exist in the received message.|
|contains||Checks whether a node contains the expected value. Case-sensitive.|
|not contains||Checks whether a node does not contain the expected value. Case-sensitive.|
|regex||Checks whether the actual value matches the specified regular expression.|
Add more assertions for response and request contents: