go-test-quality

Provide Go testing patterns for unit, integration, and fuzz tests.

64|9|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/eduardo-sl/go-agent-skills --skill go-test-quality
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-test-quality
Source: https://github.com/eduardo-sl/go-agent-skills/tree/main/skills/%28testing%29/go-test-quality
Command: npx skills add https://github.com/eduardo-sl/go-agent-skills --skill go-test-quality

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Many Go codebases suffer from brittle, unmaintainable, or incomplete tests that fail in CI, hide regressions, or produce flaky results; this Skill provides patterns and guidance to make tests reliable, readable, and production-grade.

Core Features & Use Cases

  • Emphasizes testing behavior over implementation and clear, bug-report style test names.
  • Covers structured subtests, test helpers, t.Cleanup, t.Helper, parallel tests, table-driven patterns, and TestMain for shared setup.
  • Guides HTTP handler testing with httptest, golden file testing, mocking strategies and function injection, integration tests using testcontainers, fuzz testing, and coverage analysis.
  • Use when writing new tests, improving coverage, reviewing test quality, setting up CI test infrastructure, or diagnosing flaky tests.

Quick Start

Improve tests for the current Go package by adding focused subtests, reusable test helpers, golden file checks, httptest or testcontainers-based integration tests, and fuzz tests where applicable.

Frequently Asked Questions about go-test-quality

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

FAQPage Schema
How do I write robust Go unit tests using table-driven patterns and subtests?

Robust Go unit tests use table-driven patterns with structured subtests, t.Helper for readable failure traces, and t.Cleanup for resource teardown to isolate test behavior and improve maintainability.

What's the best way to set up integration tests in Go using testcontainers?

Integration tests in Go using testcontainers provision disposable dependencies like databases within test runs, enabling reliable end-to-end coverage without manual setup or flaky shared environments.

How does golden file testing work in Go test suites?

Golden file testing in Go compares actual test output against committed expected output files, capturing complex data structures or large responses to detect unexpected regressions automatically.

How do I mock HTTP handlers and inject functions for Go testing?

Mock HTTP handlers in Go use the httptest package to simulate server responses, while function injection and interface-based mocks allow replacing dependencies to test behavior without external calls.

Why are my Go tests flaky in CI and how do I fix parallel test execution?

Flaky Go tests in CI often stem from shared state or improper synchronization; applying parallel test execution with t.Parallel and TestMain setup ensures proper isolation and reliable results.

When should I use fuzz testing in a Go codebase?

Fuzz testing in Go should be used to automatically generate edge-case inputs for complex functions, uncovering security vulnerabilities and panics that standard table-driven unit tests might miss.