Skip to content
Latchkey

Bruno "bru run" failed tests / assertions in CI

The Bruno CLI (bru run) executes a collection of .bru requests and their assertions. When an assertion (like res.status: eq 200) fails or a test throws, bru run reports the failure and exits non-zero, failing the job.

What this error means

bru run prints a failed assertion or test under a request name (for example "expected 200 to equal 500") and the run summary shows failed assertions with a non-zero exit code.

bruno
  Get user (500 Internal Server Error)
     x assert: res.status equals 200
       expected 500 to equal 200
Ran 1 requests, 0 passed, 1 failed

Common causes

The API returned an unexpected status or body

The endpoint answered with something the .bru assertions do not expect, so the assertion fails.

Environment variables (base URL, token) are unset

The run did not receive the environment or --env-var values, so {{baseUrl}} or the auth token is empty and requests miss or fail.

How to fix it

Run the collection with the CI environment

  1. Install the Bruno CLI and run the collection folder with bru run.
  2. Pass the environment (or --env-var) so base URL and token resolve.
  3. Fix the API or the assertion so the run passes.
.github/workflows/ci.yml
- run: npm install -g @usebruno/cli
- run: bru run tests/bruno --env ci \
    --env-var "token=${{ secrets.API_TOKEN }}"

Emit JUnit output for CI gating

Write a JUnit report so the pipeline can parse pass/fail and surface it in the run.

Terminal
bru run tests/bruno --env ci \
  --reporter-junit results/bruno.xml

How to prevent it

  • Pass the CI environment and secrets to bru run.
  • Emit a JUnit report so results gate the pipeline.
  • Keep assertions in sync with the real API contract.

Frequently asked questions

What causes "Bruno "bru run" failed"?
The endpoint answered with something the .bru assertions do not expect, so the assertion fails.
How do I fix Bruno "bru run" failed?
Run the collection with the CI environment

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card