gotestsum

Gotestsum Advanced and Reliable Go Test Runner

Gotestsum is a smart wrapper for Go’s go test that makes testing faster, clearer, and CI-ready. It provides clean summaries, highlights failures, and generates JUnit-compatible reports, helping developers quickly spot issues and streamline testing for projects of any size.

$ gotestsum --format testdox ./...

✔ TestUserAuth_Login (0.23s)
✔ TestUserAuth_Logout (0.11s)
✔ TestDatabase_Connect (0.45s)
✔ TestDatabase_Query (0.18s)
✖ TestPayment_Stripe (0.92s)
--- FAIL: invalid API key
✔ TestCache_Redis (0.07s)
✔ TestCache_Invalidate (0.14s)
✔ TestEmail_Send (0.33s)

DONE 9 tests, 1 failure in 3.2s

$ gotestsum --watch
watching for changes...
  
gotestsum v1.12.0 | Go 1.21 • 9 tests

What is Gotestsum?

Gotestsum is a powerful wrapper for Go’s built-in go test command that enhances test reporting. It produces clear, concise, and readable outputs, highlighting passed, failed, and skipped tests, making it easier for developers to quickly identify issues in their code.

It also supports generating JUnit-compatible XML reports for continuous integration pipelines. Gotestsum is ideal for large Go projects, improving test visibility, streamlining debugging, and saving development time by summarizing test results in a fast, CI-friendly, and visually structured way.

  • Clean, color-coded test summaries for quick review.

  • Generates JUnit-compatible reports for CI/CD pipelines.

  • Supports rerunning only failed tests to save time.

  • Works seamlessly with large Go codebases and local development.

Features of Gotestsum

Gotestsum enhances Go testing by providing clear, structured outputs that make it easy to track and understand test results. Its color-coded summaries and detailed reports improve productivity, reduce debugging time, and ensure developers can quickly identify and fix issues.

Test Summaries

Gotestsum provides clean, color-coded test summaries, making it easy for developers to quickly review test results, identify failures, and understand project health at a glance.

JUnit Reports

It generates JUnit-compatible reports, enabling seamless integration with CI/CD pipelines and providing standardized test results for automated workflows, dashboards, and team collaboration.

Failed Test Rerun

Developers can rerun only failed tests, saving time during development and debugging by focusing on issues without repeating successful test cases that unnecessarily.

folder_type_maven_opened

Large Project Support

Gotestsum efficiently handles large Go codebases, managing multiple packages and tests while maintaining performance, readability, and clear outputs for complex projects.

CI/CD Friendly

Its structured output and reporting features are optimized for continuous integration environments, ensuring smooth automation and fast feedback on code changes across teams.

Local Development

Gotestsum enhances local testing by providing readable summaries, verbose outputs, and clear failure messages, helping developers identify problems early before pushing code to production.

How It Works

Up and Running in 60 seconds

Gotestsum works as a lightweight wrapper around Go’s go test, executing your tests while enhancing output clarity and structure. Simply install it, run a single command, and instantly receive organized, color-coded, and CI-ready test results within seconds.

Install Gotestsum

Install Gotestsum using the Go install command. Once added to your environment, it works as a lightweight wrapper around go test without changing your existing project structure.

Run Your Tests

Execute a simple Gotestsum command in your project directory. It runs all Go tests while enhancing the output with structured, color-coded, and easy-to-read summaries.

Review & Integrate

Analyze clear test results instantly, rerun failed tests if needed, and generate JUnit-compatible reports for seamless integration with your CI/CD pipeline and automated workflows efficiently.

Flags & Commands

Gotestsum provides powerful flags and commands that enhance Go testing workflows, offering flexible output formats, automated reruns, CI integration support, and improved debugging capabilities for efficient and structured test execution.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

FLAG DESCRIPTION EXAMPLE
--format <format> Output format: testdox, dots, short, standard-verbose, standard-quiet, pkgname. gotestsum --format testdox ./...
--junitfile <file> Write a JUnit XML test report to the specified file path. gotestsum --junitfile results.xml ./...
--watch Re-run tests automatically when Go source files change in the current directory. gotestsum --watch
--rerun-fails N Re-run failed tests up to N times (default 2) to identify flaky tests. gotestsum --rerun-fails=3 ./...
--packages <pkgs> Specify space-separated packages to test. Useful with watch mode. gotestsum --packages ./auth ./...
--post-run-command <cmd> Run a command after each test run. Environment variables for totals and failures are available. gotestsum --post-run-command ./notify.sh
--debug Print additional debug output to help diagnose testing problems. gotestsum --debug ./...
--no-summary <types> Disable summary sections such as skipped, failed, errors, or output. gotestsum --no-summary=skipped
CI/CD Integration

Works with every CI pipeline

Gotestsum seamlessly integrates with any CI pipeline, enhancing Go test execution with clear output, JUnit reports, and improved diagnostics. Whether using GitHub Actions, GitLab CI, Jenkins, or others, it ensures consistent, reliable, and developer-friendly test reporting everywhere.

.github/workflows/test.yml

- name: Run tests
  run: |
    go install gotest.tools/gotestsum@latest
    gotestsum \
      --junitfile results.xml \
      --format testdox \
      ./...

- name: Publish Test Results
  uses: dorny/test-reporter@v1
  with:
    name: Go Tests
    path: results.xml
    reporter: java-junit
  
.gitlab-ci.yml

test:
  stage: test
  image: golang:1.21
  script:
    - go install gotest.tools/gotestsum@latest
    - gotestsum
        --junitfile report.xml
        --format testdox
        ./...
  artifacts:
    reports:
      junit: report.xml
    when: always
  
.circleci/config.yml

jobs:
  test:
    docker:
      - image: cimg/go:1.21
    steps:
      - checkout

      - run:
          name: Install gotestsum
          command: |
            go install \
              gotest.tools/gotestsum@latest

      - run:
          name: Run tests
          command: |
            gotestsum \
              --junitfile results.xml \
              ./...

      - store_test_results:
          path: results.xml
  
Comparison

Gotestsum vs Go Test

While go test runs Go tests efficiently, Gotestsum enhances the experience with cleaner output, structured summaries, JUnit report generation, and better CI integration. It transforms raw test logs into readable, actionable results making debugging faster and pipelines more reliable.

Feature gotestsum ✨ go test
Human-readable output
Color-coded results
Multiple output formats
JUnit XML reports
Watch mode
Flaky test detection (rerun)
Post-run commands
Standard Go tests support
Works without extra tools
CI-friendly output
Features in gotestsum
10 /10
Features in go test
3 /10
Migration time
0 s
Apps

Plays well with everything

Gotestsum seamlessly integrates with any Go project, CI/CD pipeline, or development workflow. From GitHub Actions and GitLab CI to Jenkins or local testing, it ensures readable output, structured reports, and reliable test automation without extra configuration.

Go

Github-colorCreated with Sketch.

Github

CI/CD

file_type_circleci

CircleCI

Docker

Kubernetes

Terraform

CodCov

Frequently Asked Questions

What is Gotestsum?

Gotestsum is a Go test runner wrapper that formats test outputs, generates JUnit reports, and improves readability and CI integration for Go projects without modifying the underlying tests.

Gotestsum enhances go test by providing readable summaries, color-coded output, JUnit reports, flaky test detection, and better CI pipeline integration, making debugging and reporting easier.

Gotestsum is designed specifically for Go (Golang) projects, wrapping the standard go test command to provide better output and CI/CD compatibility.

It formats raw Go test logs into a structured summary, color codes results, and highlights failures and skipped tests, making it easier to interpret outcomes quickly.

Yes, Gotestsum runs all Go tests within a project, including sub-packages, while keeping the original test functionality intact and adding enhanced reporting features.

Does Gotestsum integrate with CI/CD pipelines?

Yes, it works seamlessly with GitHub Actions, GitLab CI, Jenkins, CircleCI, and other pipelines, generating structured reports and readable output for automated testing workflows.

Gotestsum can produce JUnit XML reports for CI systems, human-readable summaries for the terminal, and other structured formats suitable for test tracking and dashboards.

It can rerun failing tests automatically, helping detect intermittent or flaky issues, improving reliability and confidence in automated pipelines.

Yes, it runs inside Docker containers and uses the same go test execution, ensuring consistent results in isolated CI/CD environments.

Absolutely, developers can run it locally for readable outputs, summaries, and test reports, making local debugging more efficient without relying on CI tools.

Does Gotestsum support color-coded test output?

Yes, it color-codes passed, failed, and skipped tests, making it easy to scan results and identify issues at a glance.

It generates detailed summaries showing total tests run, failed, skipped, and durations, improving visibility into project testing health.

By producing structured output, rerunning flaky tests, and integrating with CI systems, Gotestsum reduces manual monitoring and simplifies automation workflows.

Minimal setup is needed; usually just installing the binary and running tests, although options exist for customizing output, formats, and file locations.

Yes, it records the execution time of each test and presents it in summaries, helping identify slow or performance-critical tests.

Can Gotestsum handle sub-packages in a Go project?

Yes, it recursively runs tests across all sub-packages, ensuring comprehensive coverage while maintaining readable output and structured summaries.

It can be installed using go install for the latest version, allowing easy updates and integration with Go projects or CI environments.

No, it acts as a wrapper, leaving the underlying go test behavior unchanged while enhancing output formatting and reporting capabilities.

By providing clear logs, summaries, and color-coded output, developers can quickly locate failing tests, skipped tests, and performance bottlenecks.

Yes, it is open-source, allowing contributions, transparency, and adaptation for specific project or CI requirements.

GoTestSum – Free Online Test Summaries & Exam Prep Tool

GoTestSum makes exam preparation effortless. Generate test summaries, review key points, and improve your scores efficiently with our free online tool.

Price: Free

Price Currency: $

Operating System: Windows

Application Category: Software

Editor's Rating:
4.6
Scroll to Top