golang-testing

Implement TDD, table-driven tests, mocking, and HTTP handler testing for Go code.

Updated Mar 4, 2026
One-click install
npx skills add https://github.com/Fabio29T/Everything-Claude --skill golang-testing-fabio29t
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-testing
Source: https://github.com/Fabio29T/Everything-Claude/tree/main/docs/ja-JP/skills/golang-testing
Command: npx skills add https://github.com/Fabio29T/Everything-Claude --skill golang-testing-fabio29t

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive strategy for ensuring the quality and reliability of Go code through Test-Driven Development (TDD) and robust testing practices.

Core Features & Use Cases

  • TDD Workflow: Guides you through writing failing tests before implementation.
  • Table-Driven Tests: Enables systematic testing of multiple scenarios.
  • Mocking & Stubbing: Facilitates isolation of components for focused testing.
  • Use Case: When developing a new API endpoint in Go, use this Skill to write unit tests for the handler, mock external dependencies like database calls, and ensure the endpoint behaves correctly under various conditions.

Quick Start

Write a table-driven test for a Go function that adds two integers.

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 for a Go function?

Table-driven tests in Go use a struct slice to define multiple input scenarios and expected outputs, executing subtests iteratively. This Skill guides you through structuring test cases and running assertions to verify function behavior across various conditions systematically.

What's the best way to mock external dependencies in Go unit tests?

Mocking in Go unit tests uses interfaces to stub external dependencies like database calls. This Skill demonstrates how to isolate components by replacing real implementations with mock objects, ensuring focused and reliable testing of specific handlers.

How does fuzz testing work in Go projects?

Fuzz testing in Go automatically generates random inputs to uncover edge cases and potential panics in code logic. This Skill provides examples of writing fuzz tests to ensure robustness by validating function behavior against unexpected input data.

Can I use TDD workflow to develop a new API endpoint in Go?

TDD workflow supports developing a new API endpoint by writing failing tests before implementation. This Skill guides you through the Red-Green-Refactor cycle to structure HTTP handler tests, mock dependencies, and ensure endpoints behave correctly under various conditions.

How do I benchmark Go code to measure performance?

Benchmarking Go code measures execution time and memory allocations using the testing package. This Skill covers writing benchmark functions to evaluate performance bottlenecks and ensure code reliability during intensive operations.