golang-testing

Implement table-driven tests, subtests, benchmarks, and fuzz tests in Go projects.

8|1|Updated Dec 6, 2025
One-click install
npx skills add https://github.com/zzh0u/gojet --skill golang-testing-zzh0u
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-testing
Source: https://github.com/zzh0u/gojet/tree/main/.claude/skills/golang-testing
Command: npx skills add https://github.com/zzh0u/gojet --skill golang-testing-zzh0u

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Solve unreliable Go testing by providing comprehensive Go testing patterns.

Core Features & Use Cases

  • Table-Driven Tests: use table-driven patterns to cover multiple inputs concisely.
  • Subtests and Parallelism: organize related tests with t.Run and run tests in parallel to improve feedback.
  • Benchmarks and Fuzzing: include performance benchmarks and fuzz tests to validate robustness.
  • Test Coverage Guidance: instructions to measure and improve test coverage in Go projects.

Quick Start

Run a sample test suite in a Go module to begin applying TDD practices to your 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 inputs?

Table-driven tests in Go use a slice of structs to define multiple input scenarios and expected outputs concisely. You iterate over these cases, executing test logic against each entry to ensure comprehensive coverage without duplicating test functions.

How do I run Go subtests in parallel to improve test suite feedback speed?

Go parallel subtests are executed by calling t.Parallel() within a t.Run block. This allows multiple subtests to run concurrently, significantly improving test execution speed and providing faster feedback on your test suite.

What is the best way to implement fuzz testing in a Go project?

Fuzz testing in Go is implemented using the testing.F type to automatically generate randomized inputs. This validates robustness by continuously feeding edge-case data into your functions to uncover unexpected panics and security vulnerabilities.

How do I measure and improve test coverage in my Go codebase?

Test coverage in a Go codebase is measured using the go test -cover command. Improving test coverage involves writing additional table-driven tests and subtests to ensure all code branches and execution paths are fully validated.

How do I add performance benchmarks to my existing Go testing suite?

Performance benchmarks in Go are added by creating functions prefixed with Benchmark that accept a *testing.B parameter. They execute code repeatedly using a loop over b.N to accurately measure execution time and memory allocation performance.