Upload Test Results
Send test results to Harness to enable flaky detection and test tracking
Upload Test Results
Uploading test results to Harness enables flaky test detection, test history tracking, and visibility in the Tests tab. This is the foundation for all test management features.
Supported Formats
JUnit XML
Java, Python, Go, Node.js, and most languages
Pipeline Examples
- run:
script: |-
# Install dependencies
pip install pytest
# Run tests with JUnit output
hcli htx -- pytest tests/ --junitxml=test-results.xml -v
# Upload to Harness
hcli test-reports upload test-results.xml- step:
type: Run
name: Run Tests
spec:
shell: Sh
command: |
hcli htx -- ./gradlew clean test
hcli test-reports upload "build/test-results/test/*.xml"- run:
script: |-
# Install JUnit reporter
go install github.com/jstemmer/go-junit-report/v2@latest
# Run tests and convert output to JUnit XML
hcli htx -- go test -v ./... 2>&1 | go-junit-report > report.xml
# Upload to Harness
hcli test-reports upload report.xmlView Results
After the stage uploading tests completes:
Open the pipeline execution
Click the Tests tab
You'll see:
Test Name
Fully qualified test name
Status
Pass, Fail, or Skip
Duration
How long the test took
FLAKY badge
Appears if the test has inconsistent results
Use Filter → Flaky to show only flaky tests.
Command Reference
File path
test-results.xml
Single file
Glob pattern
"**/test-results/*.xml"
Multiple files (use quotes)
Troubleshooting
Tests not appearing
Verify the file path is correct and the XML format is valid
Glob not matching
Use quotes around patterns: "build/**/*.xml"
Upload fails silently
Add --verbose flag to see detailed output
Next Steps
Once test results are uploading:
View flaky tests detected automatically
Enable quarantine to unblock deployments
Add code coverage tracking
Last updated
Was this helpful?