Skip to content

Assertion Patterns

Practical patterns for stable assertions.

Start simple

php
--- ASSERTS ---
.success == true
.id != null

Validate structure, not full payload

php
--- ASSERTS ---
.user.id | type == "string"
.user.email | test("@")
.roles | length > 0

Metadata checks

php
--- ASSERTS ---
@has_header("x-request-id")
!@has_trailer("grpc-status-details-bin")

Streaming responses

Use multiple ASSERTS blocks in response order.

php
--- ASSERTS ---
.stage == "started"

--- ASSERTS ---
.stage == "done"

Released under the MIT License.