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.
Get user (500 Internal Server Error)
x assert: res.status equals 200
expected 500 to equal 200
Ran 1 requests, 0 passed, 1 failedCommon 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
- Install the Bruno CLI and run the collection folder with
bru run. - Pass the environment (or
--env-var) so base URL and token resolve. - Fix the API or the assertion so the run passes.
- 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.
bru run tests/bruno --env ci \
--reporter-junit results/bruno.xmlHow 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.