Hello,
We are importing native Go test-execution results into SonarQube Server using go test -json.
Environment
-
SonarQube Server: 2026.1.0 (build 119033)
-
SonarScanner CLI: 7.2.0.5079
-
Go version: 1.22
-
Analysis type: Main Branch
What are we trying to achieve?
We would like SonarQube to display the complete set of test-execution measures for our Go project, including:
-
Tests
-
Failures
-
Errors
-
Skipped tests
-
Execution time
-
Unit Test Success
Current configuration
The Go test-execution report is generated with:
go test -v -json \
-coverprofile=unit.out \
-covermode=atomic ./... \
2>&1 | tee unit.json
The reports are imported using:
sonar.go.tests.reportPaths=<path-to-unit.json>
sonar.go.coverage.reportPaths=<path-to-unit.out>
Observed behaviour
SonarQube successfully imports the report and displays:
-
Tests: 54
-
Failures: 0
-
Skipped: 0
-
Execution time
However, the following measures are absent rather than displayed with a value:
-
Unit Test Errors (
test_errors) -
Unit Test Success (
test_success_density)
The relevant scanner log contains no import warnings:
Investigation performed
The official Go JSON test-event format provides pass, fail, and skip actions, but it does not provide a separate error outcome:
The current SonarGo importer appears to save the following metrics:
-
SKIPPED_TESTS -
TEST_EXECUTION_TIME -
TESTS -
TEST_FAILURES
It does not appear to save TEST_ERRORS:
SonarQube defines Unit Test Success as:
test_success_density =
(tests - (test_errors + test_failures)) / tests * 100
Because the native Go importer does not appear to populate test_errors, it seems that SonarQube cannot calculate test_success_density.
Metric definition:
Is the absence of test_errors and test_success_density intentional for native Go test-execution reports? Is there a workaround to achieve those metrics?
Thank you.