testing

📁 mte90/dotfiles 📅 Today
2
总安装量
1
周安装量
#75437
全站排名
安装命令
npx skills add https://github.com/mte90/dotfiles --skill Testing

Agent 安装分布

amp 1
cline 1
opencode 1
cursor 1
kimi-cli 1
codex 1

Skill 文档

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