What problem does it solve?
This Skill unit addresses the need for comprehensive testing practices in Go, enabling developers to write robust, maintainable, and reliable code through Test-Driven Development (TDD) and best practices.
Core Features & Use Cases
- TDD Methodology: Follows a RED-GREEN-REFACTOR cycle for development.
- Table-Driven Tests: Enables comprehensive test coverage with minimal code.
- Subtests and Sub-benchmarks: Organizes related tests and benchmarks for clarity and efficiency.
- Test Helper Functions: Provides utility functions for setup, assertions, and cleanup.
- Golden Files: Allows for testing against expected outputs.
- Mocking: Utilizes interface-based mocking for dependency isolation.
- Benchmarks: Performs basic and memory allocation benchmarks.
- Fuzzing: Implements fuzz tests for input validation.
- Test Coverage: Offers guidance on coverage targets and how to exclude generated code.
- HTTP Handler Testing: Demonstrates testing of HTTP handlers.
- Testing Commands: Lists common testing commands in Go.
Quick Start
To begin using this Skill unit, open the SKILL.md file and review the TDD workflow and testing patterns outlined within.