go-testing

Write idiomatic Go tests with table-driven cases, subtests, and interface mocks.

6|1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/wesleyosantos91/multi-agents --skill go-testing-wesleyosantos91
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-testing
Source: https://github.com/wesleyosantos91/multi-agents/tree/main/devin/.devin/skills/go-testing
Command: npx skills add https://github.com/wesleyosantos91/multi-agents --skill go-testing-wesleyosantos91

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill solves the problem of fragile, low-coverage Go tests by guiding you to write idiomatic, maintainable test suites with consistent patterns.

Core Features & Use Cases

  • Table-driven tests for covering multiple input/output cases in a predictable way.
  • Subtests with t.Run to organize complex setups and verify different behaviors under the same test umbrella.
  • Mocks via interfaces to isolate units and test behavior without relying on real dependencies.
  • Integration tests with Testcontainers to validate behavior against real infrastructure like PostgreSQL.
  • HTTP handler tests using httptest to verify API responses and status codes.
  • Benchmarks and race detection to catch performance regressions and data races during CI.

Quick Start

Use the go-testing skill to generate table-driven unit tests and an integration test skeleton for a Go service that accesses PostgreSQL.

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 cases?

Interface-based mocking in Go isolates units by defining dependencies as interfaces and substituting mock implementations during tests. This skill applies mocks at the point of use to test behavior without relying on real database or service dependencies.

How do I set up PostgreSQL integration tests in Go without a persistent database?

PostgreSQL integration tests use Testcontainers to spin up containerized database instances dynamically during the test run. This skill generates Testcontainers-based integration test skeletons to validate behavior against real infrastructure cleanly.

Does Go test race detection work with benchmarks and subtests?

HTTP handler tests in Go use the `httptest` package to simulate requests and capture responses without starting a full server. This skill generates `httptest`-based validation to verify API status codes and response payloads directly.

Can I use t.Run subtests to organize complex test setups in Go?

Subtests with `t.Run` organize complex setups by nesting test cases under a single parent test umbrella in Go. This skill implements nested subtest setups to verify different behaviors while maintaining shared initialization logic.