Go
Test Suite Monitoring for Go (gotestsum)
Monitor your Go test suite health with TestGlance
Get Started in 3 Steps
- 1Install gotestsum: `go install gotest.tools/gotestsum@latest` (or use go-junit-report — see Reporter Configuration below)
- 2Run tests with JUnit output: `gotestsum --junitfile test-results/go.xml ./...`
- 3Add the TestGlance GitHub Action to your CI workflow
Reporter Configuration
go test -v ./... 2>&1 | go-junit-report > test-results/go.xmlGitHub Actions Workflow
# .github/workflows/test.yml
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- run: go install gotest.tools/gotestsum@latest
- name: Run tests
run: gotestsum --junitfile test-results/go.xml ./...
- name: Report to TestGlance
if: always()
uses: testglance/action@v1
with:
api-key: ${{ secrets.TESTGLANCE_API_KEY }}
report-path: test-results/go.xmlWhat You Get
- ✓Flaky test detection — automatically identify tests that pass and fail intermittently
- ✓Duration trends — track which tests are getting slower over time
- ✓Health score — a single metric summarizing your test suite reliability
- ✓CI summary — rich test result summaries directly in your GitHub Actions runs
FAQ
What is gotestsum and why use it?
gotestsum is a Go test runner that wraps `go test` and adds features like JUnit XML output, colored output, and test summarization. It is the recommended way to generate JUnit XML from Go tests.
Can I use go-junit-report instead of gotestsum?
Yes. You can pipe `go test` output through go-junit-report: `go test -v ./... 2>&1 | go-junit-report > test-results/go.xml`. Both tools produce compatible JUnit XML.
Does TestGlance support Go subtests?
Yes. Go subtests created with `t.Run()` appear as individual test cases in the JUnit XML output, so TestGlance can track each subtest independently.
Start Monitoring Your Go (gotestsum) Tests
Free to get started. Set up in under 5 minutes.
Get Started