Skip to content

JUnit XML

JUnit XML files could be converted to Flakiness Report via the Flakiness CLI. Once JUnit XML files are converted into a Flakiness Report, this report can be either viewed locally or uploaded.

To convert JUnit XML report(s) into a Flakiness report, run:

Terminal window
flakiness convert-junit <junit-root-dir-path>

Options:

  • <junit-root-dir-path> - Path to JUnit XML file or directory containing XML files
  • --output-dir <dir> - Output directory for the report (default: flakiness-report)
  • --env-name <name> - Environment name for the report (default: junit)
  • --commit-id <id> - Git commit ID (auto-detected if not provided)
  • --project <org/project> - Flakiness.io project slug for OIDC uploads (env: FLAKINESS_PROJECT)

The command will:

  • Read JUnit XML files (single file or recursively from a directory)
  • Auto-detect the git commit ID from your repository (unless --commit-id is provided)
  • Generate a Flakiness report and save it as report.json in the specified output directory.

Example:

Terminal window
# Convert test results XML files into a Flakiness report.
flakiness convert-junit ./test-results --env-name ci --output-dir ./flakiness-report
flakiness upload ./flakiness-report

After your tests produce JUnit XML files, add steps to convert and upload them.

No secrets needed — requires --project and id-token: write permission. See the GitHub Actions guide for more details.

.github/workflows/tests.yml
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read # Required for actions/checkout
id-token: write # Required for GitHub OIDC
steps:
- uses: actions/checkout@v4
# ... your test steps that produce JUnit XML ...
- name: Install Flakiness CLI
run: curl -LsSf https://cli.flakiness.io/install.sh | sh
- name: Convert & upload
run: |
flakiness convert-junit ./test-results --project myorg/myproject
flakiness upload ./flakiness-report/report.json