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
Check exit codes
Bruno CLI returns different exit codes for scripting:
0- Execution successful1- Assertion, test, or request failed2- Output directory doesn’t exist3- Infinite loop detected4- Not in collection root directory5- Input file doesn’t exist6- Environment doesn’t exist255- 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:SSL Certificates
Use custom CA certificates: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
Best Practices
Store collections in version control
Store collections in version control
Keep your Bruno collections alongside your code in Git. This ensures tests stay in sync with your API changes.
Use environments for different stages
Use environments for different stages
Create separate environment files for Development, Staging, and Production:
Generate reports for visibility
Generate reports for visibility
Always generate test reports in CI to track failures and history:
Use --bail for fast feedback
Use --bail for fast feedback
In CI pipelines, use
--bail to fail fast and save build time:Keep secrets in CI variables
Keep secrets in CI variables
Never commit sensitive data. Use CI environment variables:
Exit Codes Reference
Use these exit codes for scripting and CI failure detection:| Code | Meaning |
|---|---|
| 0 | Execution successful |
| 1 | Assertion, test, or request failed |
| 2 | Output directory doesn’t exist |
| 3 | Request chain loops endlessly |
| 4 | Not in collection root directory |
| 5 | Input file doesn’t exist |
| 6 | Environment doesn’t exist |
| 7 | Environment override not string or object |
| 8 | Environment override malformed |
| 9 | Invalid output format |
| 255 | Other error occurred |