go-testing

Write Go unit tests using the standard testing package.

11|2|Updated Feb 18, 2026
One-click install
npx skills add https://github.com/the-perfect-developer/the-perfect-opencode --skill go-testing-the-perfect-developer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-testing
Source: https://github.com/the-perfect-developer/the-perfect-opencode/tree/main/.opencode/skills/go-testing
Command: npx skills add https://github.com/the-perfect-developer/the-perfect-opencode --skill go-testing-the-perfect-developer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go developers often struggle to write consistent, maintainable unit tests, leading to flaky tests and slow development cycles.

Core Features & Use Cases

  • Provides conventions for Go test files (_test.go), supports table-driven tests, subtests, benchmarks, and fuzz testing to improve reliability and readability.
  • Includes guidance on test organization, example usage of t.Run, t.Parallel, TestMain patterns, and common testing pitfalls to speed up debugging.

Quick Start

Create a _test.go file with a TestXxx function to validate your code using Go's testing package.

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?

Table-driven tests in Go use a slice of structs to define test cases, iterating through them with t.Run to create subtests. This pattern improves test reliability and readability by separating test data from test logic.

What is the best way to structure Go test files?

Go test files should end with _test.go and reside in the same package directory. Using TestMain for setup and t.Parallel for concurrent execution ensures proper test organization and faster, more reliable testing cycles.

How do I run Go benchmarks and fuzz tests?

Go benchmarks and fuzz tests use the standard testing package to validate performance and find edge cases. You define BenchmarkXxx and FuzzXxx functions to execute repeated runs and identify unexpected input vulnerabilities.

Can I use t.Run and t.Parallel for Go subtests?

Yes, t.Run creates subtests for isolated execution, and t.Parallel signals that a subtest can run concurrently with other parallel tests. Using both ensures faster test execution while maintaining strict test isolation.