Skip to main content

JUnit Reporter

The Testream JUnit Reporter converts JUnit XML into a CTRF report and uploads the results to Testream.

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

OptionDescriptionDefault
-k, --api-key <key>Testream API key (*required unless --no-upload is used)-
-j, --junit-path <path/glob>Path or glob to JUnit XML file(s)target/surefire-reports/TEST-*.xml
--output-dir <dir>Output directory for CTRF reportctrf
--output-file <file>CTRF file namectrf-report.json
--branch <name>Git branch nameauto (CI)
--commit-sha <sha>Git commit SHAauto (CI)
--repository-url <url>Git repository URLauto (CI)
--build-name <name>Build name/identifierauto (CI)
--build-number <num>Build numberauto (CI)
--build-url <url>Build URLauto (CI)
--test-environment <env>Test environment (e.g., ci, staging)-
--app-name <name>Application name under test-
--app-version <ver>Application version under test-
--test-type <type>Test type (e.g., unit, integration, e2e)-
--no-uploadSkip uploading (convert + write report only)false
--fail-on-errorExit with non-zero code if upload failsfalse

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

NPM Package

What's Next?