Skip to content

Generating Reports

bru run provides built-in support for generating reports in three formats: JSON, JUnit, and HTML. These reports help with analyzing test results and integrating with various CI/CD tools.

You can generate any combination of these reports and even run them simultaneously. Every reporter flag is also listed in the Output & Reporting options reference.

JSON Report

To generate a report in JSON format, use the --reporter-json option:

```bash copy bru run --reporter-json results.json

This will output the test results in a results.json file, which can be useful for further processing or programmatic analysis.

### JUnit Report

To generate a report in JUnit format, use the `--reporter-junit` option:

```bash copy
bru run --reporter-junit results.xml

The results.xml file will be in a format compatible with JUnit, making it ideal for integration with CI/CD pipelines that rely on JUnit reporting.

classname format

Breaking change (v4): The classname attribute on each <testcase> element changed from the request URL to the collection path. If you were using classname to identify tests in Xray, Azure DevOps, or similar tools, update any mappings to use the new format.

Each <testcase> uses the path from the collection root to the request as the classname. This keeps test identities stable across environments and the same request running against staging and production produces the same classname.

<!-- Before (v3): classname was the request URL -->
<testcase name="Status is 200" classname="https://staging.api.example.com/users" />
<testcase name="Status is 200" classname="https://prod.api.example.com/users" />

<!-- After (v4): classname is the collection path -->
<testcase name="Status is 200" classname="Users/Get Users" />

The path includes all parent folder names separated by /, followed by the request name. Example: Payments/Invoices/Create Invoice. This makes the classname unique even when the same request name exists in multiple folders, and ensures CI tools treat runs across different environments as the same test case rather than creating duplicates.

HTML Report

To generate a human-readable HTML report, use the --reporter-html option:

```bash copy bru run --reporter-html results.html

This will create an results.html file that provides a visual representation of the test outcomes, ideal for quick reviews.

### Running Multiple Reporters Simultaneously

You can generate multiple reports at once by specifying more than one reporter option. For example, to generate JSON, JUnit, and HTML reports simultaneously, run:

```bash copy
bru run --reporter-json results.json --reporter-junit results.xml --reporter-html results.html

This command will create three files: results.json, results.xml, and results.html, allowing you to analyze the results in different formats as needed.

Secret Masking in Reports: When running CLI and generating reports, sensitive data like secrets can be automatically masked to prevent exposure. Learn more about Secret Masking.

Skipping Specific Headers in the Report

If you want to exclude certain headers from the report, use the --reporter-skip-headers option. You can list multiple headers to skip, separated by spaces.

bru run --reporter-html results.html --reporter-skip-headers "Authorization" "X-Auth-Token"

Skip All Headers in the Report

To exclude all headers from the report, use the --reporter-skip-all-headers option. This will remove all headers from the output report, ensuring a cleaner result.

```bash copy bru run --reporter-html results.html --reporter-skip-all-headers

## Skipping Request and Response Bodies in the Report

Reports can include large request and response payloads. Use these flags to omit bodies and keep report files smaller:

| Option | Description |
| ------ | ----------- |
| `--reporter-skip-request-body` | Omits request bodies from reports |
| `--reporter-skip-response-body` | Omits response bodies from reports |
| `--reporter-skip-body` | Shorthand: omits both request and response bodies from reports |

**Behavior:**

| Flags used | Result |
| ---------- | ------ |
| Both `--reporter-skip-request-body` and `--reporter-skip-response-body` | Omits both request and response bodies |
| Neither (default) | Reports include both request and response bodies |

**Examples:**

```bash copy
# Omit only request bodies
bru run --reporter-html results.html --reporter-skip-request-body

# Omit only response bodies
bru run --reporter-html results.html --reporter-skip-response-body

# Omit both (shorthand)
bru run --reporter-html results.html --reporter-skip-body