Testing

SKILL.md

Golang Testing Standards

Priority: P0 (CRITICAL)

Principles

Guidelines

TDD Workflow

  1. Red: Write a failing table-driven test case.
  2. Green: Implement logic to pass.
  3. Refactor: Simplify code.

Golden Snippet

See Table-Driven Tests for full template.

Tools

  • Stdlib: testing package is usually enough.
  • Testify (stretchr/testify): Assertions (assert, require) and Mocks.
  • Mockery: Auto-generate mocks for interfaces.
  • GoMock: Another popular mocking framework.

Naming

  • Test file: *_test.go
  • Test function: func TestName(t *testing.T)
  • Example function: func ExampleName()

Anti-Patterns

  • Sleeping in tests: Use channels/waitgroups or retry logic.
  • Testing implementation details: Test public behavior/interface.

References

Weekly Installs
11
Repository
mte90/dotfiles
GitHub Stars
45
First Seen
Feb 28, 2026
Installed on
opencode11
gemini-cli11
claude-code11
github-copilot11
codex11
kimi-cli11