4. Validate With Assertion

Applies to ReadyAPI 3.53, last modified on June 07, 2024

After configuring the Data Source test step, you can add an assertion to validate response data. In this tutorial, we will use Smart Assertion that is automatically generated based on the patterns recognized in responses.

Your test case should have the REST Request test step that uses data from a data source:

ReadyAPI: The REST Request test step

Click the image to enlarge it.

1. Get response

To begin, you need to simulate a request and get some sample responses. ReadyAPI will use the data to automatically configure assertion properties.

Switch to the test case editor and click Run test case on the editor toolbar:

ReadyAPI: Running the test case

Now, you can create an assertion.

2. Create an assertion

  1. Switch to the REST Request and click Smart Assertion:

    Functional API testing: Smart Assertion button

    Click the image to enlarge it.

  2. ReadyAPI will create an assertion based on the most recent response and automatically configure which values are expected for which data fields:

    Functional API testing: Smart Assertion

    Click the image to enlarge it.

  3. You can uncheck boxes to exclude certain fields from the assertion or configure comparison operators and expected values. When you are done, click Save:

    Functional API testing: Configure assertion

    Click the image to enlarge it.

You have added the Smart Assertion to your test request. It will verify that the response data matches the expected values. You can find the added assertion in the Assertions panel:

ReadyAPI: The REST request with the assertion

Click the image to enlarge it.

Now you can run the test.

Prev          Next

See Also

Data-Driven Functional Tests

Highlight search results