golang-testing

Write table-driven, subtest, benchmark, and fuzz tests for Go modules.

25|13|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/aaione/everything-claude-code-cn --skill golang-testing-aaione
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-testing
Source: https://github.com/aaione/everything-claude-code-cn/tree/main/skills/golang-testing
Command: npx skills add https://github.com/aaione/everything-claude-code-cn --skill golang-testing-aaione

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go testing patterns address the difficulty of maintaining reliable, scalable tests in Go projects by standardizing testing practices and providing a cohesive workflow.

Core Features & Use Cases

  • Table-driven tests to cover multiple input scenarios with a compact, readable pattern.
  • Subtests and parallel tests to organize related test cases and speed up feedback loops.
  • Benchmarks and fuzz testing to measure performance and stress input handling in Go code.
  • Real-world use: a module gradually increasing test coverage for a critical library using TDD to drive design.

Quick Start

Run go test ./... to execute the test suite and start validating the codebase.

Frequently Asked Questions about golang-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write table-driven tests in Go to cover multiple input scenarios?

Table-driven tests in Go use a struct slice of inputs and expected outputs, executing subtests via t.Run to cover multiple scenarios efficiently. This approach standardizes test cases for maintainable Go modules.

What is the best way to structure Go benchmarks for performance measurement?

Go benchmarks structure performance measurement by running functions repeatedly using the testing.B object. This measures execution time and allocates operations to validate code speed and identify performance regressions in Go libraries.

Can I use fuzz testing to stress input handling in my Go code?

Fuzz testing in Go stresses input handling by automatically generating random inputs to find edge cases and panics. It integrates with Go tooling to continuously parse malformed data and validate code robustness.

How do I run parallel subtests to speed up Go test execution feedback loops?

Parallel subtests speed up Go test execution by calling t.Parallel within t.Run blocks. This allows concurrent test execution across multiple CPU cores, significantly reducing feedback loops for large test suites.

Does TDD work with standard Go testing tooling for library development?

TDD works seamlessly with standard Go testing tooling by using go test ./... to validate modules. It drives library design incrementally, increasing test coverage through table-driven tests and benchmarks.