Skip to content

Ingesting JUnit XML

You'll need
  • a test runner that can emit JUnit XML
  • a GitHub repository for the CI examples below
You'll have
  • your JUnit-producing runner uploading reports to Flakiness.io on every push and PR.

Most test runners don’t expose a structured API for consuming results, but most can write JUnit XML — the de-facto standard for test output. The Flakiness CLI converts JUnit XML into Flakiness JSON reports and uploads them to the platform.

The flow has four steps:

  1. Produce JUnit XML from your test runner (most have a flag or a built-in reporter for this).
  2. Install the Flakiness CLI on your CI runner.
  3. Convert the XML to a Flakiness report with flakiness convert-junit.
  4. Upload the report with flakiness upload.

flakiness convert-junit does more than parse XML:

  • Auto-detects the environment — OS name, version, and architecture.
  • Auto-detects the git commit ID from the working tree.
  • Accepts --project to tag the report with your flakinessProject identifier.
  • Accepts --category to tag the report (bun, rust, etc.) so the dashboard renders the right runner icon and groups history correctly.
  • Accepts --title, --commit-id, --output-dir, and more. See the convert-junit reference.

Rust doesn’t have a native Flakiness reporter. The simplest path is cargo-nextest, a drop-in cargo test replacement that emits JUnit XML.

  1. Adopt cargo-nextest. If your project doesn’t already use it, install it locally and switch your test command from cargo test to cargo nextest run. See the nextest installation guide for the recommended install for your OS.

  2. Configure the ci profile to emit JUnit XML:

    .config/nextest.toml
    [profile.ci.junit]
    path = "junit.xml"
  3. Wire it into CI:

    .github/workflows/tests.yml
    jobs:
    test:
    runs-on: ubuntu-latest
    permissions:
    contents: read # for actions/checkout
    id-token: write # for Flakiness.io OIDC
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
    - run: cargo nextest run --profile ci
    - name: Convert and upload to Flakiness.io
    if: always()
    run: |
    curl -LsSf https://cli.flakiness.io/install.sh | sh
    flakiness convert-junit ./target/nextest/ci/junit.xml --category rust --project my-org/my-app
    flakiness upload ./flakiness-report/report.json

bun test has built-in JUnit XML output.

  1. Emit JUnit XML by adding --reporter=junit --reporter-outfile=./junit.xml to your bun test invocation.

  2. Wire it into CI:

    .github/workflows/tests.yml
    jobs:
    test:
    runs-on: ubuntu-latest
    permissions:
    contents: read # for actions/checkout
    id-token: write # for Flakiness.io OIDC
    steps:
    - uses: actions/checkout@v4
    - uses: oven-sh/setup-bun@v2
    - run: bun install
    - run: bun test --reporter=junit --reporter-outfile=./junit.xml
    - name: Convert and upload to Flakiness.io
    if: always()
    run: |
    curl -LsSf https://cli.flakiness.io/install.sh | sh
    flakiness convert-junit ./junit.xml --category bun --project my-org/my-app
    flakiness upload ./flakiness-report/report.json