Agent skill · software engineering · aiskillstore
golang-testing
Comprehensive Go testing patterns including table-driven tests, mocking,
Why this skill is useful
Provides specific Go testing patterns and practices that the AI wouldn't reliably generate on its own.
What it needs
About 4k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
Golang Testing This skill provides guidance on comprehensive testing strategies for Go applications including unit tests, integration tests, benchmarks, and test organization. When to Use This Skill When writing unit tests for Go code When creating table-driven tests When mocking dependencies with interfaces When writing integration tests with test containers When benchmarking performance-critical code When organizing test suites and fixtures Table-Driven Tests Basic Pattern With Error Cases Interface-Based Mocking Define Interfaces Create Mock Implementations Use in Tests Testify Assertions Integration Tests with Testcontainers Test Fixtures Setup/Teardown Pattern Per-Test Setup Benchmarks Testing HTTP Handlers Test Organization File Structure Build Tags for Integration Tests Run with: go test -tags=integration ./... Coverage Best Practices 1. Test behavior, not implementation - Focus on inputs and outputs 2. One assertion per test - Keep tests focused and clear 3. Use t.Helper() - Mark helper functions for better error reporting 4. Parallel tests - Use t.Parallel() for independent tests 5. Descriptive names - TestUserServiceCreateUserWithInvalidEmail 6. Test edge cases - Empty inputs, nil values, boundary conditions 7. Keep tests fast - Use mocks, skip slow tests with -short 8. Avoid test pollution - Each test should be independent
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/golang-testing