Skip to main content

Overview

Bruno CLI enables you to automate API testing in your continuous integration and deployment workflows. Run your collections in GitHub Actions, GitLab CI, Jenkins, or any other CI/CD platform.

Installation

Install Bruno CLI in your CI environment:

Basic Usage

1

Navigate to your collection

The Bruno CLI needs to be run from your collection directory.
2

Run all requests

Execute all requests in your collection:
3

Check exit codes

Bruno CLI returns different exit codes for scripting:
  • 0 - Execution successful
  • 1 - Assertion, test, or request failed
  • 2 - Output directory doesn’t exist
  • 3 - Infinite loop detected
  • 4 - Not in collection root directory
  • 5 - Input file doesn’t exist
  • 6 - Environment doesn’t exist
  • 255 - Other error occurred

Running Specific Tests

Single Request

Run a specific request file:

Folder of Requests

Run all requests in a subfolder:

With Environment

Specify an environment for your tests:

Tests Only

Run only requests that have tests defined:

Output and Reporting

JSON Output

Save test results as JSON:

JUnit Report

Generate JUnit XML for CI integration:

Multiple Reporters

Generate multiple report formats:

GitHub Actions Integration

Here’s a real example from Bruno’s own CI pipeline:

GitLab CI Integration

.gitlab-ci.yml

Jenkins Pipeline

Jenkinsfile

Advanced CLI Options

Environment Variables

Override individual environment variables:
Override multiple variables:

SSL Certificates

Use custom CA certificates:
Use only custom CA (ignore default truststore):

Request Control

Bail on Failure

Stop execution after first failure:

Add Delay

Add delay between requests (in milliseconds):

Skip Headers

Skip headers in reports:

Insecure Mode

Allow insecure server connections:

CSV Data-Driven Testing

Run collection with CSV data:

Client Certificates

Provide client certificate configuration:

Docker Integration

Run Bruno tests in a Docker container:
Dockerfile
Use in CI:

Best Practices

Keep your Bruno collections alongside your code in Git. This ensures tests stay in sync with your API changes.
Create separate environment files for Development, Staging, and Production:
Always generate test reports in CI to track failures and history:
In CI pipelines, use --bail to fail fast and save build time:
Never commit sensitive data. Use CI environment variables:

Exit Codes Reference

Use these exit codes for scripting and CI failure detection:

Troubleshooting

Error: Not in collection root directoryMake sure you’re running bru from the directory containing bruno.json. Use cd to navigate to your collection first.
Error: Environment doesn’t existCheck that your environment file exists in the environments/ folder and the name matches exactly (case-sensitive).
Debugging CI failuresAdd the --output results.json flag to capture detailed error information for debugging failed CI runs.