table-driven-test
Installation
SKILL.md
Table-Driven Test Guidelines
Table-driven tests define multiple test cases in a slice of structs, then iterate over them executing the same test logic. This makes it easy to add cases, improves readability, and reduces duplication.
When to use table-driven tests:
- You have 3+ similar test cases that vary by inputs/outputs
- Tests follow the same logic pattern with different data
- Most unit and integration tests benefit from this structure
When to skip:
- Only 1-2 simple test cases (overhead not worth it)
- Each test requires completely different logic
- Test setup/teardown varies significantly between cases
Not the same as: Datadriven tests (different library with testdata files)