go-testing

Write Go tests using table-driven tests, subtests, benchmarks, and fuzzing.

1|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/yandy-r/claude-plugins --skill go-testing-yandy-r
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-testing
Source: https://github.com/yandy-r/claude-plugins/tree/main/.cursor-plugin/skills/go-testing
Command: npx skills add https://github.com/yandy-r/claude-plugins --skill go-testing-yandy-r

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers design, implement, and maintain reliable Go tests by applying established testing patterns and a disciplined TDD workflow.

Core Features & Use Cases

  • Table-driven tests to cover multiple input scenarios with concise test code.
  • Subtests, parallel tests, and helper patterns (t.Run, t.Helper, t.Cleanup) for readable, maintainable test suites.
  • Benchmarks and fuzzing (Go 1.18+) to evaluate performance and resilience, including httptest-based HTTP testing and golden files for baselining outputs.

Quick Start

Start by writing a failing Go test for a small function, then incrementally implement the function to pass tests and refactor for clarity.

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 to cover multiple input scenarios?

Table-driven tests in Go use a struct slice to define input scenarios and expected results, iterating through them to execute concise test code. You can combine them with t.Run for readable subtests and parallel execution to maximize coverage.

What is the best way to structure Go test suites using subtests and helpers?

Structuring Go test suites involves using t.Run for subtests, t.Helper for test helpers, and t.Cleanup for resource teardown. These patterns ensure your test code remains readable, maintainable, and properly organized across complex scenarios.

Does Go 1.18 fuzzing work with established testing patterns like table-driven tests?

Yes, Go 1.18 fuzzing integrates with established testing patterns to evaluate resilience. You can run fuzz tests alongside table-driven tests and benchmarks to detect unexpected panics and edge-case failures within your test suite.

How do I benchmark Go functions and baseline outputs with golden files?

Benchmarking Go functions uses the testing.B type to measure performance. You can baseline outputs using golden files, comparing actual results against saved expected files to detect regressions in output data across refactoring.

Can I use httptest for HTTP testing and mocks in my Go project?

Yes, httptest provides utilities for HTTP testing by simulating server responses and client requests. You can use it alongside mocks to isolate dependencies and verify HTTP handler behavior in Go without requiring real network connections.