go-testing

Go testing patterns. Routes to specific patterns.

⭐2stars🔀0forks📁View on GitHub🕐Updated Dec 28, 2025

When & Why to Use This Skill

This Claude skill provides a comprehensive collection of idiomatic Go testing patterns and best practices. It streamlines the creation of robust test suites by offering standardized templates for table-driven tests, subtests, benchmarks, and helper functions, ensuring high code quality and maintainability in Golang projects.

Use Cases

  • Implementing table-driven tests to efficiently validate multiple input-output scenarios within a single test function.
  • Organizing complex test logic into hierarchical subtests using t.Run for improved readability and targeted execution.
  • Creating reusable test helper functions that leverage t.Helper() to provide accurate error reporting and cleaner test code.
  • Benchmarking Go code performance using standard library patterns to identify and resolve bottlenecks.
  • Ensuring Go testing best practices, such as proper naming conventions and safe parallel test execution.
namego-testing
descriptionGo testing patterns. Routes to specific patterns.

Testing

Route by Pattern

Quick Check

  • Tests named Test_Function_Scenario
  • Table tests for >2 cases
  • Helpers call t.Helper()
  • Parallel tests capture loop vars

Common Patterns

Basic test structure:

func Test_Function_Scenario(t *testing.T) {
    // Arrange
    input := "test"

    // Act
    result := Function(input)

    // Assert
    if result != expected {
        t.Errorf("got %v, want %v", result, expected)
    }
}