Assertions
Assertions allow you to declaratively write tests without writing any code.
Getting Started
- Open a request and click on the Assert tab
- Add assertions by specifying:
- Expression: The value to test (e.g.,
res.status,res.body.id) - Operator: The comparison operator
- Value: The expected value
- Expression: The value to test (e.g.,

Common Examples
Basic Response Testing
| Expression | Operator | Value |
|---|---|---|
res.status | equals | 200 |
res.body.status | equals | success |
res.body.message | contains | created |
res.body.id | isNotEmpty |
Nested Objects
{
"user": {
"profile": {
"name": "John",
"email": "john@example.com"
}
}
}| Expression | Operator | Value |
|---|---|---|
res.body.user.profile.name | equals | John |
res.body.user.profile.email | contains | @example.com |
Arrays
{
"users": [
{ "id": 1, "name": "Alice" },
{ "id": 2, "name": "Bob" }
]
}| Expression | Operator | Value |
|---|---|---|
res.body.users | isNotEmpty | |
res.body.users[0].name | equals | Alice |
res.body.users[1].id | equals | 2 |
Using res() Query
For complex nested data, use the res() function:
{
"order": {
"items": [
{ "id": 1, "price": 29.99 },
{ "id": 2, "price": 69.99 }
]
}
}| Expression | Operator | Value |
|---|---|---|
res('order.items[0].price') | equals | 29.99 |
res('..price') | isNotEmpty |
Learn more about res() in Response Query docs.
Response Headers
| Expression | Operator | Value |
|---|---|---|
res.headers['content-type'] | contains | application/json |
Response Time
| Expression | Operator | Value |
|---|---|---|
res.responseTime | lt | 1000 |
Available Operators
- Comparison:
equals,notEquals,gt,gte,lt,lte - String:
contains,notContains,startsWith,endsWith,matches,notMatches - Type Checks:
isNull,isNotEmpty,isEmpty,isDefined,isUndefined - Value Checks:
isTruthy,isFalsy,isNumber,isString,isBoolean,isArray,isJson - Other:
in,notIn,between,length
Advanced Testing
For complex test scenarios with custom logic, use Test Scripts with JavaScript and Chai assertions.
Last updated on