What problem does it solve?
This Skill provides a comprehensive guide to writing effective, maintainable, and robust tests in Go, ensuring code quality and reliability.
Core Features & Use Cases
- Test-Driven Development (TDD): Enforces the RED-GREEN-REFACTOR cycle.
- Table-Driven Tests: Mandates the use of table-driven tests for clarity and efficiency.
- Test Helper Policies: Standardizes the use of
t.Helper() and t.Cleanup() for better error reporting and resource management.
- Parallel Execution: Guides on using
t.Parallel() for faster test runs.
- Mocking Strategies: Demonstrates interface-based mocking for dependency injection.
- Coverage Targets: Defines clear goals for test coverage.
- Use Case: When developing a new Go feature, follow these guidelines to write tests that are easy to understand, run quickly, and provide excellent coverage, catching bugs early in the development cycle.
Quick Start
Follow the TDD workflow by writing a failing test first for your Go function.