Applies to ReadyAPI 2.8, last modified on August 16, 2019

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 and SOAP responses and generate an assertion based on the recognized patterns. To validate a response:

Adding validation of the REST and SOAP responses

Click the image to enlarge it.

  1. Send a request, using the REST Request or SOAP Request test step.

    Tip: It is better to send a request several times. This produces more data ReadyAPI can analyze.
  2. 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.
  3. 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

  1. Open a test step in the editor and click Add Assertion.

    SoapUI: The Add Assertion button

    Click the image to enlarge it.

  1. Open a security test, click Response Assertions next to a security scan, and click Add in the Assertions panel.

    Secure: The Assertions panel

    Click the image to enlarge it.

  1. Expand the Assertions drop-down menu on the right of the virtual service editor and click Add.

    ServiceV: The Assertions panel

    Click the image to enlarge it.

  1. 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.
  2. 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 Clone on the toolbar of the Assertions panel and configure the following options as needed and apply the changes:

ReadyAPI: The Clone Assertions dialog

Click the image to enlarge it.

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:

  • If the option is on, clones will replace such assertions in the target test steps.

  • If the option is off, clones will not replace the existing 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:

SoapUI: The Assertions panel

Click the image to enlarge it.

Secure: The Assertions panel

Click the image to enlarge it.

ServiceV: The Assertions panel

Click the image to enlarge it.

Use the panel toolbar to manage assertions:

Command Description
Add

Click to add a new assertion.

Clone

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.

Remove

Click to delete the selected assertion.

Up and Down

Click to change the position of the selected assertion in the panel.

The assertion order is important. ReadyAPI runs assertions in the order you have specified, from the topmost to the bottom one.

The image below shows three assertions applied to a SOAP request test step. The first two passed correctly, and the last one failed:

ReadyAPI: The Assertions panel

Click the image to enlarge it.

Highlight search results