For the complete documentation index, see llms.txt. This page is also available as Markdown.

Response body equals

This is a pre-built action available under the @Assertion element type. The action validates whether the complete API response body matches the expected response body. The actual response body value stores the actual response body, and keyword status stores the validation result as True or False.

Note: An API request must be added and executed successfully before configuring or evaluating API Assertions.

Syntax

Input Value: <Expected response body>

Argument
Description

<Expected response body> (Required)

Provide the expected response body value which you want to compare with actual API response body.

Output Value: <Actual response body>(optional);<Keyword status>(optional)

Argument
Description

<Actual response body> (optional)

The actual response body stores the actual response body received from the API call.

<Keyword status> (optional)

The action status stores the execution result as True or False.

Example: Validating an Exact API Response Body

In this example, we explain how to validate that the response body received from an API call exactly matches the expected response body.

  • Action: Response body equals

  • Input Value: { "first_name": "John", "last_name": "Doe", "phone": "8765678987", "email": "johndoe@gmail.com.com", "id": 205 }

    • The value { "first_name": "John", "last_name": "Doe", "phone": "8765678987", "email": "johndoe@gmail.com.com", "id": 205 }, specifies the expected response body that the actual API response must match exactly.

  • Output Value: {ActualResponseBody};{Status}

    • The first output variable {ActualResponseBody} stores the actual response body received from the API.

    • The second output variable {Status} stores the execution result:

      • True: If the actual response body exactly matches the expected response body.

      • False: If the actual response body does not match the expected response body.

  • Logical Explanation: The Response body equals action fetches the expected response body from the Input Value column and compares it against the actual response body received from the API call. If the {ActualResponseBody} variable is defined, it stores the actual response body received. If the expected and actual response body match exactly, the {Status} variable stores True, otherwise False.

Last updated