Ingesting JUnit XML
- a test runner that can emit JUnit XML
- a GitHub repository for the CI examples below
- 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.
How it works
Section titled “How it works”The flow has four steps:
- Produce JUnit XML from your test runner (most have a flag or a built-in reporter for this).
- Install the Flakiness CLI on your CI runner.
- Convert the XML to a Flakiness report with
flakiness convert-junit. - 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
--projectto tag the report with yourflakinessProjectidentifier. - Accepts
--categoryto 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 theconvert-junitreference.
Rust doesn’t have a native Flakiness reporter. The simplest path is cargo-nextest, a drop-in cargo test replacement that emits JUnit XML.
-
Adopt
cargo-nextest. If your project doesn’t already use it, install it locally and switch your test command fromcargo testtocargo nextest run. See the nextest installation guide for the recommended install for your OS. -
Configure the
ciprofile to emit JUnit XML:.config/nextest.toml [profile.ci.junit]path = "junit.xml" -
Wire it into CI:
.github/workflows/tests.yml jobs:test:runs-on: ubuntu-latestpermissions:contents: read # for actions/checkoutid-token: write # for Flakiness.io OIDCsteps:- uses: actions/checkout@v4- uses: dtolnay/rust-toolchain@stable- run: cargo nextest run --profile ci- name: Convert and upload to Flakiness.ioif: always()run: |curl -LsSf https://cli.flakiness.io/install.sh | shflakiness convert-junit ./target/nextest/ci/junit.xml --category rust --project my-org/my-appflakiness upload ./flakiness-report/report.jsonSet
FLAKINESS_ACCESS_TOKEN(from your project’s settings), install the CLI, run nextest, then convert and upload:Terminal window curl -LsSf https://cli.flakiness.io/install.sh | shcargo nextest run --profile ciflakiness convert-junit ./target/nextest/ci/junit.xml --category rust --project my-org/my-appFLAKINESS_ACCESS_TOKEN=<token> flakiness upload ./flakiness-report/report.jsonSee CI Configuration (non-GitHub) for per-provider details (GitLab CI, CircleCI, Jenkins, etc.).
bun test has built-in JUnit XML output.
-
Emit JUnit XML by adding
--reporter=junit --reporter-outfile=./junit.xmlto yourbun testinvocation. -
Wire it into CI:
.github/workflows/tests.yml jobs:test:runs-on: ubuntu-latestpermissions:contents: read # for actions/checkoutid-token: write # for Flakiness.io OIDCsteps:- 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.ioif: always()run: |curl -LsSf https://cli.flakiness.io/install.sh | shflakiness convert-junit ./junit.xml --category bun --project my-org/my-appflakiness upload ./flakiness-report/report.jsonSet
FLAKINESS_ACCESS_TOKEN(from your project’s settings), install the CLI, run your tests with the JUnit reporter, then convert and upload:Terminal window curl -LsSf https://cli.flakiness.io/install.sh | shbun test --reporter=junit --reporter-outfile=./junit.xmlflakiness convert-junit ./junit.xml --category bun --project my-org/my-appFLAKINESS_ACCESS_TOKEN=<token> flakiness upload ./flakiness-report/report.jsonSee CI Configuration (non-GitHub) for per-provider details (GitLab CI, CircleCI, Jenkins, etc.).