Use this skill when working with Bruno API tests. Bruno stores collections as plain-text .bru files in the repo, so tests are reviewed and versioned like code.
Requires
- test-automation-guidelines
- test-api
Apply the shared API principles from test-api first; the rules below are Bruno-specific additions.
Workflow
- Confirm the collection layout and environments (
bruno.json,environments/). - Refer only to the reference file relevant to the task:
- Collection and environment structure:
references/collections.md - Assertions, scripting, and running:
references/scripting-and-assertions.md
- Collection and environment structure:
- Apply the principles and templates from that file.
Bruno Rules
Files and structure
- Keep
.brufiles in version control and review them like code — never treat the collection as a throwaway export. - One request per
.brufile, named for the behaviour it verifies. - Organise requests into folders by resource/feature (folders are plain directories on disk).
Variables and environments
- Reference the base URL and other config as variables (
{{baseUrl}}), defined per environment underenvironments/. - Store secrets as secret variables (
.env/ secret vars), never committed literals. Commit an example env with placeholders only. - Use
{{process.env.VAR}}or Bruno secret vars for credentials so they stay out of the committed.bru.
Assertions
- Prefer the declarative
assertblock for status and simple field checks. - Use the
testsblock withexpectfor schema/shape and richer logic. - Assert status and key fields; avoid asserting volatile values (see
test-apiassertions guidance).
Scripting
- Use
pre-requestscripts to obtain tokens or set up data, andpost-responsescripts for extraction/cleanup. - Capture only the specific values later requests need (e.g.
bru.setVar('orderId', res.body.id)); avoid leaking broad state. - Keep scripts small and deterministic; do not add arbitrary waits.
Anti-Patterns
- Committing
.brufiles or environment files that contain real tokens or API keys. - Hardcoded full URLs instead of
{{baseUrl}}. - Bloated
testsscripts re-implementing assertions thatasserthandles declaratively. - One
.brufile exercising many endpoints. - Relying on collection-runner order for tests that should be independent.