DEV Community

Dhruba Patra
Dhruba Patra

Posted on

Assertion Blocks in Voiden

We recently added assertion blocks to Voiden.
Not because assertions are new but because they’re usually treated as an afterthought.
When testing APIs, most of us:

  • Send a request

  • Inspect the response

  • Mentally verify “yeah, that looks right”

  • Or scatter assertions across scripts, test files, or CI configs

That works… until it doesn’t.
Assertion blocks are our attempt to make expectations explicit and first-class.
Instead of burying checks in code or external tools, you define what must be true:

  • Status codes

  • Response structure

  • Field values

  • Edge cases that shouldn’t silently pass

Right next to the request itself.
This does a few important things:
Tests become readable, not just executable

Failures explain what broke, not just that something broke

API behavior becomes documented by usage, not just specs

For teams building and testing APIs, this reduces the gap between:

  • “I think this endpoint works”
  • “We know exactly what guarantees this endpoint provides.”

We are still refining how assertion blocks evolve, but the goal is simple: less guessing, more confidence, closer to how developers actually think about APIs.

If you’re testing APIs regularly, we’d love to hear how you currently handle assertions, and what’s still painful about it.

Download Voiden here : https://voiden.md/

Top comments (0)