Skip to main content

Running API Tests

The bru run command executes your API requests and tests from the command line. You can run individual requests, folders, or entire collections.

Basic Usage

Navigate to your collection directory and run:
This runs all requests in the current collection directory.

Running Specific Requests

Single Request

Run a specific .bru file:

Folder

Run all requests in a folder:

Folder (Recursive)

Run all requests in a folder and its subfolders:

Multiple Paths

Run multiple requests and folders:

Working with Environments

Using Collection Environments

Run with a specific environment:
The CLI looks for the environment file in environments/production.bru (or .yml for OpenCollection format).

Using Environment Files

Load environment from a custom file:
Supported formats:
  • .bru - Bruno environment format
  • .json - JSON format
  • .yml/.yaml - YAML format

Global Environments

Use a global environment from a workspace:
Specify workspace path if not auto-detected:

Overriding Variables

Override specific environment variables:
Override multiple variables:

Output and Reporting

JSON Output

Save results as JSON:
Or using the reporter flag:

JUnit XML Output

Generate JUnit-compatible XML for CI/CD:
Or:

HTML Report

Generate an HTML report:
Or:

Multiple Reports

Generate multiple report formats simultaneously:

Security Options

Custom CA Certificates

Add a custom CA certificate:
Use custom CA exclusively (ignore default truststore):

Client Certificates

Use client certificates for authentication:
The config file format:
client-cert-config.json

Insecure Connections

Allow insecure server connections (skip SSL verification):
Only use this in development/testing environments. Never in production.

Execution Control

Run Only Requests with Tests

Skip requests that don’t have tests or assertions:

Bail on Failure

Stop execution immediately after any failure:

Delay Between Requests

Add a delay (in milliseconds) between each request:
This adds a 1-second delay between requests.

Tag-Based Filtering

Run only requests with specific tags:
Exclude requests with certain tags:

Proxy Configuration

Disable Proxy

Disable all proxy settings:
This disables both collection-defined proxies and system proxies.

JavaScript Sandbox

Choose the JavaScript runtime for scripts:
Options:
  • safe (default) - Uses QuickJS for security
  • developer - Uses Node.js VM for more features

Customizing Reporter Output

Skip Headers

Omit all headers from reports:
Skip specific headers:

Skip Request/Response Bodies

Omit request bodies:
Omit response bodies:
Omit both:
Disable automatic cookie handling:

Verbose Output

Enable verbose output for debugging:

Understanding Test Results

After execution, you’ll see a summary:
The CLI reports:
  • Requests - HTTP request execution status
  • Pre-Request Tests - Tests run before the request
  • Post-Response Tests - Tests run after the response
  • Tests - General test results
  • Assertions - Assertion results

Common Examples

CI/CD Pipeline

Development Testing

Smoke Tests

Testing with Custom Certificates

Exit Codes

The CLI returns different exit codes for automation:
See the CLI Overview for all exit codes.

Next Steps

CLI Options Reference

Complete reference of all CLI flags and options

Importing Collections

Import collections from OpenAPI and other formats