go/testing

Provide table-driven patterns, subtests, and helpers for Go's standard testing package.

3|1|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/deandum/claude-resources --skill go-testing-deandum
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go/testing
Source: https://github.com/deandum/claude-resources/tree/main/skills/go/testing
Command: npx skills add https://github.com/deandum/claude-resources --skill go-testing-deandum

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go testing patterns streamline how developers write and maintain tests in Go, reducing boilerplate and improving reliability.

Core Features & Use Cases

  • Table-driven tests for covering multiple scenarios in a compact form.
  • Subtests and test helpers to improve readability and reusability.
  • Function-based mocks to isolate units under test while keeping tests deterministic.

Quick Start

Run go test ./... to execute the test suite and verify table-driven tests, subtests, and mocks.

Frequently Asked Questions about go/testing

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

FAQPage Schema
How do I write table-driven tests in Go using the standard library?

Go subtests use the t.Run method to group related test cases hierarchically, allowing individual execution and isolated failure reporting. This standard library feature enhances readability and lets you run specific scenarios using test name filters.

How do I create deterministic mocks for Go unit tests without external libraries?

Go testing helpers use the t.Helper method to skip helper frames in error reports, pinpointing the exact failing line. This standard library pattern improves test readability by reducing stack trace noise and clarifying failure locations.

Does this Go testing approach work with benchmarks and modules?

Yes, this approach applies to Go projects relying on the stdlib testing package, covering unit tests, benchmarks, and test organization across modules. It enforces robust test structure and clear naming to ensure reliable outcomes.

What is the best way to organize a Go test suite for multiple scenarios?

The best way to organize a Go test suite is using table-driven patterns combined with subtests. This structure enforces clear naming and deterministic execution, reducing boilerplate while maintaining reliable coverage for multiple scenarios.