Skip to main content

JUnit Reporter

Use the Testream JUnit Reporter to convert JUnit XML output from CI/CD and send Java test results into Testream and Jira.

Looking for the commercial overview first? Read the website page for JUnit Jira integration.

If you are comparing direct JUnit ingestion with the broader CI/CD upload path, see CI/CD test results in Jira.

Installation

# Use with npx (recommended)
npx @testream/junit-reporter --help

# Or install globally
npm install -g @testream/junit-reporter

Quick Start

Convert and upload using the default JUnit XML path:

npx @testream/junit-reporter \
-k $TESTREAM_API_KEY

Convert only (skip upload) with a custom JUnit path:

npx @testream/junit-reporter \
--junit-path "./reports/**/*.xml" \
--no-upload

Defaults

  • JUnit input path: target/surefire-reports/TEST-*.xml
  • CTRF output: ctrf/ctrf-report.json

CLI Options

OptionTypeDefaultDescription
-k, --api-key <key>string-Required Testream API key
-j, --junit-path <path/glob>stringtarget/surefire-reports/TEST-*.xmlPath or glob to JUnit XML file(s)
--output-dir <dir>stringctrfOutput directory for CTRF report
--output-file <file>stringctrf-report.jsonCTRF file name
--branch <name>stringauto (CI)Git branch name
--commit-sha <sha>stringauto (CI)Git commit SHA
--repository-url <url>stringauto (CI)Git repository URL
--build-name <name>string-Build name/identifier
--build-number <num>stringauto (CI)Build number
--build-url <url>stringauto (CI)Build URL
--test-environment <env>string-Test environment (e.g., ci, staging)
--app-name <name>string-Application name under test
--app-version <ver>string-Application version under test
--test-type <type>string-Test type (e.g., unit, integration, e2e)
--no-uploadbooleanfalseSkip uploading (convert + write report only)
--fail-on-errorbooleanfalseExit with non-zero code if upload fails

Full Configuration Example

npx @testream/junit-reporter \
-k $TESTREAM_API_KEY \
--junit-path "./target/surefire-reports/TEST-*.xml" \
--output-dir ctrf \
--output-file ctrf-report.json \
--build-name "JUnit Tests" \
--test-environment ci \
--app-name "my-java-service" \
--app-version 1.0.0 \
--test-type unit \
--fail-on-error

CI Example (GitHub Actions)

.github/workflows/tests.yml
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"

- uses: actions/setup-node@v4
with:
node-version: "20"

- run: npm install -g @testream/junit-reporter

- run: mvn -B test -Dmaven.test.failure.ignore=true

- run: |
testream-junit \
--api-key "${{ secrets.TESTREAM_API_KEY }}" \
--fail-on-error

Sample Project

The testream/junit-jira-reporter repository is a complete working example of a JUnit project integrated with Testream. It includes example tests, full reporter configuration, and a ready-to-use GitHub Actions workflow.

NPM Package

What's Next?