Skip to content

Assertions

The @assert directive validates conditions on the response. Failed assertions display ❌ in the results panel.

@assert target operator [expectedValue]
TargetDescriptionExample
statusHTTP status code@assert status == 200
bodyResponse body (JSON path)@assert body.success == true
headerResponse headers@assert header.content-type contains application/json
durationResponse time in ms@assert duration < 2000
sizeResponse size in bytes@assert size < 10240
cookieResponse cookies@assert cookie.sessionId exists
OperatorDescriptionExample
==Equals@assert status == 200
!=Not equals@assert status != 500
>Greater than@assert body.items.length > 0
<Less than@assert duration < 2000
>=Greater than or equal@assert status >= 200
<=Less than or equal@assert status <= 299
containsContains text@assert body.name contains John
OperatorDescriptionExample
existsNot null/undefined@assert body.token exists
!existsIs null/undefined@assert body.error !exists
isArrayIs an array@assert body.data isArray
isNumberIs numeric@assert body.count isNumber
isNullIs null@assert body.deletedAt isNull
isUndefinedIs undefined@assert body.debug isUndefined
isEmptyIs empty@assert body.errors isEmpty
###
@name Create User
POST {{baseUrl}}/users
Content-Type: application/json
{
"name": "John",
"email": "john@example.com"
}
@assert status == 201
@assert body.id exists
@assert body.name == John
@assert body.email contains @
@assert body.roles isArray
@assert header.content-type contains application/json
@assert duration < 3000
@assert size < 5120