Use ReadyAPI assertions to validate response and request contents: response codes, header values, specific fields in JSON and XML response bodies, and so on.
Validate the response content and add more specific assertions to check if the service gets and returns data in the expected format and whether it functions properly.
To learn more about available assertions and their parameters, see Assertion Reference.
Validate response content
ReadyAPI can analyze previously received REST, GraphQL, and SOAP responses and generate an assertion based on the recognized patterns. To validate a response:
-
Send a request, using the REST Request, GraphQL Query, GraphQL Mutation, or SOAP Request test step.
Tip: It is better to send a request several times. This produces more data ReadyAPI can analyze. -
Click Smart Assertion in the Response editor.
ReadyAPI analyzes the history of received responses and adds the preconfigured Message Content assertion.
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. -
See the settings in the subsequent Message Content Assertion dialog and modify them, if needed.
Click Save.
![]() |
Smart Assertion does not work if the Test History disabled option is enabled. |
Create assertions
-
In the Add Assertion dialog, select an assertion category, pick an assertion, and click Add. The assertion will be added to the Assertions panel.
Note: Some assertions may be missing from the dialog. It happens because they are not applicable to the currently selected test step or operation.
The Recently category of the dialog lists 5 recently used assertions. -
Configure and order your assertions in the Assertions panel.
Clone assertions
You can clone assertions you used in a request or response and apply them to another test step in the same or another test case or project. To do this, click on the toolbar of the Assertions panel and configure the following options as needed and apply the changes:
Option | Description |
---|---|
Assertions |
A list of available assertions to clone. |
Target Project |
A project to clone the assertion to. |
Target TestSuite |
A test suite to clone the assertion to. |
Target TestCase |
A test case to clone the assertion to. |
Target TestSteps |
A list of available test steps to clone the assertion to. |
Overwrite |
Assertions of some types can be added several times to a test step, while assertions of some other types can be added only once. The Overwrite option affects cloning of such “one-instance” assertions:
The option does not affect multiple-instance assertions: ReadyAPI always adds copies of these assertions to the assertion list. |
Clear Existing |
Removes any existing assertions with the same name. |
Open List |
Displays the list of updated test requests. |
Assertions panel
The Assertions panel lists the assertions you added to a test step or operation. Here, you can add and modify the assertions.
To access the Assertions panel:
Use the panel toolbar to manage assertions:
Command | Description | ||
---|---|---|---|
![]() |
Click to add a new assertion. |
||
![]() |
Click to copy the selected assertion with all its settings and parameters to another test step in the same or another test case or project. See Clone assertions for details. |
||
![]() |
Click to delete the selected assertion. |
||
![]() ![]() |
Click to change the position of the selected assertion in the panel.
The image below shows three assertions applied to a SOAP request test step. The first two passed correctly, and the last one failed: |
See Also
Load Test Assertions
Security Assertions
Validating Virtual APIs