patterntypescriptTip
API Testing with Bruno: Version-controlled API collections as code
Viewed 0 times
brunoapi-testinginsomniapostmanversion-controlclici
Problem
Postman and Insomnia collections are binary JSON blobs that do not diff cleanly in version control. Team collaboration on API collections requires paying for cloud sync or manually exporting/importing files.
Solution
Use Bruno, which stores API collections as plain text files (.bru format) directly in the project repository. Collections live alongside code, diff naturally in git, and can be run in CI using the Bruno CLI.
Why
Storing API collections as code enables code review of API changes, CI execution of API tests, and zero-cost team collaboration. Collections evolve with the codebase rather than drifting in a separate tool.
Gotchas
- Bruno's .bru format is human-readable but not yet a universal standard — team members must install Bruno to use the GUI.
- Bruno does not yet have the full feature set of Postman (e.g., mock servers) — evaluate your needs.
- Secret values (API keys, passwords) should use Bruno's environment variables, never committed to the .bru files.
Code Snippets
Running Bruno collections in CI
# Install Bruno CLI
npm install -g @usebruno/cli
# Run collection against staging environment
bru run ./api-tests --env staging --reporter json > results.jsonRevisions (0)
No revisions yet.