Assertion subjects
You can assert on four properties of any HTTP request node:Status code
Response body
Access nested properties with bracket notation. Use.at(index) for array elements:
Headers
Latency
Latency is measured in milliseconds:Predicates
Comparison
| Method | Description |
|---|---|
.equals(value) | Exact equality |
.greaterThan(n) | Greater than |
.lessThan(n) | Less than |
.greaterThanOrEqual(n) | Greater than or equal |
.lessThanOrEqual(n) | Less than or equal |
String
| Method | Description |
|---|---|
.contains(str) | Contains substring |
.startsWith(str) | Starts with prefix |
.endsWith(str) | Ends with suffix |
Existence
| Method | Description |
|---|---|
.isNull() | Value is null |
.isDefined() | Value is not null |
.isEmpty() | Value is empty (empty string, array, or object) |
.isTrue() | Value is true |
.isFalse() | Value is false |
Negation
Prefix any predicate with.not to negate it:
Using with the sequential builder
The sequential builder provides a callback with a type-safestate proxy:
state proxy only exposes nodes that have been defined above the assertion, giving you compile-time autocomplete.
Using with the graph builder
With the graph builder, create a state proxy manually usingcreateStateProxy: