Response body not contains
This is a pre-built action available under @Assertion element type. This action validates whether the API response body does not contain the expected text or value. The action status variable stores the validation result as True or False.
Syntax
Input Value: <Text or value that should not be present>
<Text or value that should not be present>
(Required)
Provide the text or value that you want to search in the API response body.
Output Value: <Keyword Status(optional)>
<Keyword Status>
(Optional)
The keyword status variable stores the assertion status as True or False.
Example: Validating That a Value is Not Present in the API Response
In this example, we verify that the API response body does not contain the specified value.
Action: Response body not contains
Input Value: Unavailable
The value Unavailable specifies the text or value to search in the API response body.
JSON Response Body
{
"first_name": "John",
"last_name": "Doe",
"phone": "8765678987",
"email": "johndoe@gmail.com",
"id": 205,
"availability": "Available"
}Output Value: {Status}
The output variable {Status} stores the assertion result with the following possible values:
True: If the specified text or value is not found in the API response body.
False: If the specified text or value is found in the API response body.
Logical Explanation: The Response body not contains action fetches the expected value Unavailable from the Input Value column and searches the complete API response body for the specified value. Since Unavailable is not present in the response body, the {Status} variable stores True. If the specified value is found in the response body, the {Status} variable stores False.

Last updated