Assertion
Adding an assertion to post processor
In the Run tab (Design-first Mode) or the Request tab (Request-first mode), navigate to Post Processors.
Design-first Mode
Request-first Mode
Hover over "Add Post Processor" and select "Assertion".
Select the target for your assertion, which can be various elements in the API response such as headers, body content, or status codes. You can choose the specific element that you want to verify against your expected outcome. (For example:
$.data.status
) Please note that the root object is represented by$
, and it works for both objects and arrays.If the target is in the JSON body, use JSONPath to extract the desired value.
Set the assertion conditions based on your testing requirements. You can define criteria such as equal to, not equal to, contains, does not contain, greater than, less than, etc.
In the assertion value field, you can input a static value or use dynamic variables in the format of
In the assertion value field, you can input a static value or use dynamic variables in the format of
{{variable}}
.Click on the send button to execute the assertions. You can view the results of the assertions in the right-hand side panel.
4
not being equal to 4.0
. For such specific assertions where data comparison needs to consider more intricate details, you can utilize custom scripts to write assertions manually.Setting assersions on actual response
assertion
.Using scripts for assertions
pm.test
syntax to create assertions using scripts. Apidog is compatible with Postman scripts, allowing users to leverage existing scripts seamlessly.Modified atΒ 2025-03-17 04:25:25