Skip to main content
Assertions allow you to declaratively write tests without writing any code.

Getting Started

  1. Open a request and click on the Assert tab
  2. Add assertions by specifying:
    • Expression: The value to test (e.g., res.status, res.body.id)
    • Operator: The comparison operator
    • Value: The expected value
bru assertions

Common Examples

Basic Response Testing

Nested Objects

Arrays

Using res() Query

For complex nested data, use the res() function:
Learn more about res() in Response Query docs.

Response Headers

Response Time

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.