JUnit Reports Integration
JUnit XML is the de-facto interchange format for test results — Maven Surefire, Gradle, Jest, Go test wrappers, and most test runners can produce it. cdviz-collector send --run testsuiterun_junit wraps your test command, collects the XML after the process exits, and emits testSuiteRun.started / testSuiteRun.finished CDEvents with per-suite results.
Setup
Wrap your test command; the collector picks up the report after the process exits. The built-in glob matches **/TEST-*.xml and **/*.xml — pass --data <path-or-glob> when the report lives elsewhere or unrelated XML files could match. Full flags shown once here, shortened in the per-tool examples below:
cdviz-collector send --run testsuiterun_junit \
--metadata "tested_artifact_id=pkg:oci/my-app@sha256:$IMAGE_SHA" \
--url "$CDVIZ_URL" \
--header "Authorization: Bearer $CDVIZ_TOKEN" \
-- <your test command>Branch, commit, and job name are auto-detected from CI environment variables — see CI auto-detection. Use --metadata tested_artifact_id=… to link results to the artifact under test.
NOTE
testsuiterun_junit requires the parser_xml feature flag. Verify with cdviz-collector --version.
Examples by Ecosystem
Java — Maven
# Surefire writes TEST-*.xml under target/surefire-reports/ (matches the default glob)
cdviz-collector send --run testsuiterun_junit \
--url "$CDVIZ_URL" \
-- mvn testJava / Kotlin — Gradle
# Gradle writes JUnit XML under build/test-results/test/
cdviz-collector send --run testsuiterun_junit \
--data "build/test-results/test/*.xml" \
--url "$CDVIZ_URL" \
-- ./gradlew testPython — pytest
cdviz-collector send --run testsuiterun_junit \
--url "$CDVIZ_URL" \
-- pytest --junit-xml=TEST-results.xmlSee the pytest integration for the full walkthrough.
JavaScript / TypeScript — Bun
cdviz-collector send --run testsuiterun_junit \
--data TEST-results.xml \
--url "$CDVIZ_URL" \
-- bun test --reporter=junit --reporter-outfile=TEST-results.xmlJavaScript / TypeScript — Vitest
cdviz-collector send --run testsuiterun_junit \
--data TEST-results.xml \
--url "$CDVIZ_URL" \
-- npx vitest run --reporter=junit --outputFile=TEST-results.xmlJavaScript / TypeScript — Jest
Jest needs the jest-junit reporter package (writes junit.xml by default):
cdviz-collector send --run testsuiterun_junit \
--data junit.xml \
--url "$CDVIZ_URL" \
-- npx jest --ci --reporters=default --reporters=jest-junitNode.js — built-in test runner
Node 21+ ships a junit reporter (older versions can use the TAP reporter with --run testsuiterun_tap instead):
cdviz-collector send --run testsuiterun_junit \
--data TEST-results.xml \
--url "$CDVIZ_URL" \
-- node --test --test-reporter=junit --test-reporter-destination=TEST-results.xmlRust — cargo-nextest
cargo test has no JUnit output; cargo-nextest does, via a profile:
# .config/nextest.toml
[profile.ci.junit]
path = "junit.xml" # written under target/nextest/ci/cdviz-collector send --run testsuiterun_junit \
--data target/nextest/ci/junit.xml \
--url "$CDVIZ_URL" \
-- cargo nextest run --profile ciGo — gotestsum
go test has no JUnit output; gotestsum wraps it:
cdviz-collector send --run testsuiterun_junit \
--data TEST-results.xml \
--url "$CDVIZ_URL" \
-- gotestsum --junitfile TEST-results.xml ./....NET
With the JunitXml.TestLogger NuGet package:
cdviz-collector send --run testsuiterun_junit \
--data TEST-results.xml \
--url "$CDVIZ_URL" \
-- dotnet test --logger "junit;LogFilePath=TEST-results.xml"Related
- pytest — Python-specific example (pytest emits JUnit XML)
- SARIF — the same pattern for linters and scanners
- CI pipelines: GitHub Actions CI, GitLab CI, Jenkins
- Full flag list:
send --runreference