Skip to main content

No project description provided

Project description

dbt to JUnit XML

Convert dbt's target/run_results.json into a JUnit XML report so Azure DevOps (ADO) can display dbt test results in the Tests tab.

This tool is designed for CI: it reads the run results produced by dbt build, generates a single JUnit report, and writes it to a file that can be published by ADO.

What it reads

  • Input: dbt run_results.json (typically target/run_results.json)
  • Source of truth: the results list inside that file
  • Filtering: by default, only dbt tests are included (unique_id starts with test.)

What it writes

  • Output: a JUnit XML file (default: dbt-junit.xml)
  • Structure: one <testsuite> containing one <testcase> per dbt test

Install / run (local)

If you're using this repo with uv:

uv sync
uv run dbt-junit-xml --input target/run_results.json --output dbt-junit.xml

You can also run it directly with Python:

python -m src.main --input target/run_results.json --output dbt-junit.xml

CLI options

  • --input: path to run_results.json (default: target/run_results.json)
  • --output: output XML path (default: dbt-junit.xml)
  • --log-level: DEBUG|INFO|WARNING|ERROR (default: INFO)
  • --include-models: include non-test nodes as testcases (default: off)

Exit codes (CI-friendly)

  • 0: report generated and no failing dbt tests
  • 1: report generated and at least one dbt test failed/errored
  • 2: could not generate report (missing file, invalid JSON, unexpected format, etc.)

Azure DevOps pipeline example

Run dbt (which produces target/run_results.json), generate the JUnit XML, then publish it:

- script: |
    dbt build
    dbt-junit-xml --input target/run_results.json --output dbt-junit.xml
  displayName: "Run dbt and generate JUnit report"

- task: PublishTestResults@2
  displayName: "Publish dbt test results"
  inputs:
    testResultsFormat: "JUnit"
    testResultsFiles: "dbt-junit.xml"
    failTaskOnFailedTests: true

Notes / tips

  • If your pipeline working directory is not the dbt project root, pass an explicit --input path.
  • If you only want dbt tests in ADO, do not pass --include-models (default behavior already filters to tests).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbt_to_junit-0.1.1.tar.gz (134.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbt_to_junit-0.1.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file dbt_to_junit-0.1.1.tar.gz.

File metadata

  • Download URL: dbt_to_junit-0.1.1.tar.gz
  • Upload date:
  • Size: 134.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for dbt_to_junit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6acb3c996d3007e0c376258c124243bbb939988569b5e349d439c4fbcbf0b997
MD5 4a35dda08d9ad5d52bd5a13569e8f2c1
BLAKE2b-256 7782a0a1e61d2c4c4fb448384c61e97789605ef91020227e7823f1258a1f0b82

See more details on using hashes here.

File details

Details for the file dbt_to_junit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dbt_to_junit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for dbt_to_junit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c432f8c7efa6975991a474141b219b81c213bd29ec0f0f3481db8b09bd486be
MD5 222e88000841c3e8095a221128d5a1d2
BLAKE2b-256 15491b3e49f20f334cdb1d2a8f926ff84fa5628175fb7b7d57bf5ecdbeb08a63

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page